mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
custom weapon natives/code update
This commit is contained in:
parent
245932a825
commit
ee2c5c4f8b
@ -61,13 +61,11 @@ native get_statsnum();
|
|||||||
native get_user_stats2(index,stats[4]);
|
native get_user_stats2(index,stats[4]);
|
||||||
native get_stats2(index,stats[4]);
|
native get_stats2(index,stats[4]);
|
||||||
|
|
||||||
/*
|
/* Custom weapons support ( like: gasnades, lasers ) */
|
||||||
* Custom weapons support ( like: gasnades, lasers )
|
native reg_custom_weapon( wpnname[],melee = 0,logname[]="" );
|
||||||
*/
|
native custom_weapon_dmg( weapon, att, vic, damage, hitplace );
|
||||||
native register_cwpn( name[] );
|
native custom_weapon_shot( weapon,index ); // weapon id , player id
|
||||||
native custom_wpn_dmg( wId,att,vic,dmg,hitplace=0 );
|
native get_custom_wpnname( weapon,szName[],len );
|
||||||
native custom_wpn_shot( index,wid );
|
|
||||||
native get_custom_wpnname( wId,name[],len );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forwards
|
* Forwards
|
||||||
|
@ -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
|
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){
|
if (index<1||index>gpGlobals->maxClients){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int weapon = params[2];
|
int weapon = params[1];
|
||||||
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].ammoSlot ){
|
if ( weapon < MAX_WEAPONS || weapon >= MAX_WEAPONS+MAX_CWEAPONS || !weaponData[weapon].ammoSlot ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
|
MF_PrintSrvConsole("Weapon ID Is Not Valid!\n");
|
||||||
@ -419,9 +419,9 @@ AMX_NATIVE_INFO stats_Natives[] = {
|
|||||||
{ "reset_user_wstats", reset_user_wstats },
|
{ "reset_user_wstats", reset_user_wstats },
|
||||||
|
|
||||||
// Custom Weapon Support
|
// Custom Weapon Support
|
||||||
{ "register_cwpn", register_cwpn },
|
{ "reg_custom_weapon", register_cwpn },
|
||||||
{ "custom_wpn_dmg", custom_wpn_dmg },
|
{ "custom_weapon_dmg", custom_wpn_dmg },
|
||||||
{ "custom_wpn_shot", custom_wpn_shot },
|
{ "custom_weapon_shot", custom_wpn_shot },
|
||||||
{ "get_custom_wpnname", get_custom_wpnname },
|
{ "get_custom_wpnname", get_custom_wpnname },
|
||||||
|
|
||||||
{"register_statsfwd",register_forward },
|
{"register_statsfwd",register_forward },
|
||||||
|
@ -333,12 +333,12 @@ static cell AMX_NATIVE_CALL register_cwpn(AMX *amx, cell *params){ // name,logna
|
|||||||
|
|
||||||
int iLen;
|
int iLen;
|
||||||
char *szName = MF_GetAmxString(amx, params[1], 0, &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].name,szName);
|
||||||
strcpy(weaponData[i].logname,szLogName);
|
strcpy(weaponData[i].logname,szLogName);
|
||||||
weaponData[i].needcheck = true;
|
weaponData[i].needcheck = true;
|
||||||
weaponData[i].melee = params[3] ? true:false;
|
weaponData[i].melee = params[2] ? true:false;
|
||||||
return i;
|
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
|
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){
|
if (index<1||index>gpGlobals->maxClients){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int weapon = params[2];
|
int weapon = params[1];
|
||||||
if ( weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS ){
|
if ( weapon < DODMAX_WEAPONS-DODMAX_CUSTOMWPNS ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
@ -439,9 +439,9 @@ AMX_NATIVE_INFO stats_Natives[] = {
|
|||||||
{ "reset_user_wstats", reset_user_wstats },
|
{ "reset_user_wstats", reset_user_wstats },
|
||||||
|
|
||||||
// Custom Weapon Support
|
// Custom Weapon Support
|
||||||
{ "reg_custom_wpn", register_cwpn },
|
{ "reg_custom_weapon", register_cwpn }, // name,melee,logname
|
||||||
{ "custom_wpn_dmg", cwpn_dmg },
|
{ "custom_weapon_dmg", cwpn_dmg },
|
||||||
{ "custom_wpn_shot", cwpn_shot },
|
{ "custom_weapon_shot", cwpn_shot },
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
@ -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
|
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){
|
if (index<1||index>gpGlobals->maxClients){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int weapon = params[2];
|
int weapon = params[1];
|
||||||
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){
|
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
@ -363,9 +363,9 @@ AMX_NATIVE_INFO stats_Natives[] = {
|
|||||||
{ "reset_user_wstats", reset_user_wstats },
|
{ "reset_user_wstats", reset_user_wstats },
|
||||||
|
|
||||||
// Custom Weapon Support
|
// Custom Weapon Support
|
||||||
{ "reg_custom_wpn", register_cwpn },
|
{ "reg_custom_weapon", register_cwpn },
|
||||||
{ "custom_wpn_dmg", cwpn_dmg },
|
{ "custom_weapon_dmg", cwpn_dmg },
|
||||||
{ "custom_wpn_shot", cwpn_shot },
|
{ "custom_weapon_shot", cwpn_shot },
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
@ -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
|
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){
|
if (index<1||index>gpGlobals->maxClients){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int weapon = params[2];
|
int weapon = params[1];
|
||||||
if ( weapon < TSMAX_WEAPONS-TSMAX_CUSTOMWPNS ){
|
if ( weapon < TSMAX_WEAPONS-TSMAX_CUSTOMWPNS ){
|
||||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||||
return 0;
|
return 0;
|
||||||
@ -363,9 +363,9 @@ AMX_NATIVE_INFO stats_Natives[] = {
|
|||||||
{ "reset_user_wstats", reset_user_wstats },
|
{ "reset_user_wstats", reset_user_wstats },
|
||||||
|
|
||||||
// Custom Weapon Support
|
// Custom Weapon Support
|
||||||
{ "reg_custom_wpn", register_cwpn },
|
{ "reg_custom_weapon", register_cwpn },
|
||||||
{ "custom_wpn_dmg", cwpn_dmg },
|
{ "custom_weapon_dmg", cwpn_dmg },
|
||||||
{ "custom_wpn_shot", cwpn_shot },
|
{ "custom_weapon_shot", cwpn_shot },
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user