From ee2c5c4f8bd2e60bdfc0912f96217769b5b7d481 Mon Sep 17 00:00:00 2001 From: Lukasz Wlasinksi Date: Wed, 4 Aug 2004 10:42:29 +0000 Subject: [PATCH] custom weapon natives/code update --- dlls/csstats2/amxx_package/csstats.inc | 12 +++++------- dlls/csstats2/csstats/rank.cpp | 10 +++++----- dlls/dod2/dodx/NRank.cpp | 14 +++++++------- dlls/tfc/tfcx/NRank.cpp | 10 +++++----- dlls/ts/tsx/NRank.cpp | 10 +++++----- 5 files changed, 27 insertions(+), 29 deletions(-) diff --git a/dlls/csstats2/amxx_package/csstats.inc b/dlls/csstats2/amxx_package/csstats.inc index f7d49e87..3fd58f1f 100755 --- a/dlls/csstats2/amxx_package/csstats.inc +++ b/dlls/csstats2/amxx_package/csstats.inc @@ -61,13 +61,11 @@ native get_statsnum(); native get_user_stats2(index,stats[4]); native get_stats2(index,stats[4]); -/* -* Custom weapons support ( like: gasnades, lasers ) -*/ -native register_cwpn( name[] ); -native custom_wpn_dmg( wId,att,vic,dmg,hitplace=0 ); -native custom_wpn_shot( index,wid ); -native get_custom_wpnname( wId,name[],len ); +/* Custom weapons support ( like: gasnades, lasers ) */ +native reg_custom_weapon( wpnname[],melee = 0,logname[]="" ); +native custom_weapon_dmg( weapon, att, vic, damage, hitplace ); +native custom_weapon_shot( weapon,index ); // weapon id , player id +native get_custom_wpnname( weapon,szName[],len ); /* * Forwards diff --git a/dlls/csstats2/csstats/rank.cpp b/dlls/csstats2/csstats/rank.cpp index c5aab00c..2ef40791 100755 --- a/dlls/csstats2/csstats/rank.cpp +++ b/dlls/csstats2/csstats/rank.cpp @@ -351,13 +351,13 @@ static cell AMX_NATIVE_CALL custom_wpn_dmg(AMX *amx, cell *params){ // wid,att,v } static cell AMX_NATIVE_CALL custom_wpn_shot(AMX *amx, cell *params){ // player,wid - int index = params[1]; + int index = params[2]; if (index<1||index>gpGlobals->maxClients){ MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; } - int weapon = params[2]; + int weapon = params[1]; if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].ammoSlot ){ MF_RaiseAmxError(amx,AMX_ERR_NATIVE); MF_PrintSrvConsole("Weapon ID Is Not Valid!\n"); @@ -419,9 +419,9 @@ AMX_NATIVE_INFO stats_Natives[] = { { "reset_user_wstats", reset_user_wstats }, // Custom Weapon Support - { "register_cwpn", register_cwpn }, - { "custom_wpn_dmg", custom_wpn_dmg }, - { "custom_wpn_shot", custom_wpn_shot }, + { "reg_custom_weapon", register_cwpn }, + { "custom_weapon_dmg", custom_wpn_dmg }, + { "custom_weapon_shot", custom_wpn_shot }, { "get_custom_wpnname", get_custom_wpnname }, {"register_statsfwd",register_forward }, diff --git a/dlls/dod2/dodx/NRank.cpp b/dlls/dod2/dodx/NRank.cpp index 5b370e9c..f3915eb0 100755 --- a/dlls/dod2/dodx/NRank.cpp +++ b/dlls/dod2/dodx/NRank.cpp @@ -333,12 +333,12 @@ static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logna int iLen; char *szName = MF_GetAmxString(amx, params[1], 0, &iLen); - char *szLogName = MF_GetAmxString(amx, params[2], 0, &iLen); + char *szLogName = MF_GetAmxString(amx, params[3], 0, &iLen); strcpy(weaponData[i].name,szName); strcpy(weaponData[i].logname,szLogName); weaponData[i].needcheck = true; - weaponData[i].melee = params[3] ? true:false; + weaponData[i].melee = params[2] ? true:false; return i; } @@ -407,13 +407,13 @@ static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg } static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid - int index = params[1]; + int index = params[2]; if (index<1||index>gpGlobals->maxClients){ MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; } - int weapon = params[2]; + int weapon = params[1]; if ( weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS ){ MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; @@ -439,9 +439,9 @@ AMX_NATIVE_INFO stats_Natives[] = { { "reset_user_wstats", reset_user_wstats }, // Custom Weapon Support - { "reg_custom_wpn", register_cwpn }, - { "custom_wpn_dmg", cwpn_dmg }, - { "custom_wpn_shot", cwpn_shot }, + { "reg_custom_weapon", register_cwpn }, // name,melee,logname + { "custom_weapon_dmg", cwpn_dmg }, + { "custom_weapon_shot", cwpn_shot }, { NULL, NULL } }; diff --git a/dlls/tfc/tfcx/NRank.cpp b/dlls/tfc/tfcx/NRank.cpp index 8364f15f..46eff464 100755 --- a/dlls/tfc/tfcx/NRank.cpp +++ b/dlls/tfc/tfcx/NRank.cpp @@ -332,13 +332,13 @@ static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg } static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid - int index = params[1]; + int index = params[2]; if (index<1||index>gpGlobals->maxClients){ MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; } - int weapon = params[2]; + int weapon = params[1]; if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){ MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; @@ -363,9 +363,9 @@ AMX_NATIVE_INFO stats_Natives[] = { { "reset_user_wstats", reset_user_wstats }, // Custom Weapon Support - { "reg_custom_wpn", register_cwpn }, - { "custom_wpn_dmg", cwpn_dmg }, - { "custom_wpn_shot", cwpn_shot }, + { "reg_custom_weapon", register_cwpn }, + { "custom_weapon_dmg", cwpn_dmg }, + { "custom_weapon_shot", cwpn_shot }, { NULL, NULL } }; diff --git a/dlls/ts/tsx/NRank.cpp b/dlls/ts/tsx/NRank.cpp index b0bfd9af..ac08a9c4 100755 --- a/dlls/ts/tsx/NRank.cpp +++ b/dlls/ts/tsx/NRank.cpp @@ -332,13 +332,13 @@ static cell AMX_NATIVE_CALL cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg } static cell AMX_NATIVE_CALL cwpn_shot(AMX *amx, cell *params){ // player,wid - int index = params[1]; + int index = params[2]; if (index<1||index>gpGlobals->maxClients){ MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; } - int weapon = params[2]; + int weapon = params[1]; if ( weapon < TSMAX_WEAPONS-TSMAX_CUSTOMWPNS ){ MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; @@ -363,9 +363,9 @@ AMX_NATIVE_INFO stats_Natives[] = { { "reset_user_wstats", reset_user_wstats }, // Custom Weapon Support - { "reg_custom_wpn", register_cwpn }, - { "custom_wpn_dmg", cwpn_dmg }, - { "custom_wpn_shot", cwpn_shot }, + { "reg_custom_weapon", register_cwpn }, + { "custom_weapon_dmg", cwpn_dmg }, + { "custom_weapon_shot", cwpn_shot }, { NULL, NULL } };