small tweaks ..
This commit is contained in:
@ -362,100 +362,6 @@ static cell AMX_NATIVE_CALL TFC_SetPDdata(AMX *amx, cell *params) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL TFC_register_cwpn(AMX *amx, cell *params){ // name,logname,melee=0
|
||||
int i;
|
||||
bool bFree = false;
|
||||
for ( i=TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS;i<TFCMAX_WEAPONS;i++){
|
||||
if ( !weaponData[i].ammoSlot ){
|
||||
bFree = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bFree )
|
||||
return 0;
|
||||
|
||||
int iLen;
|
||||
char *szName = MF_GetAmxString(amx, params[1], 0, &iLen);
|
||||
|
||||
strcpy(weaponData[i].name,szName);
|
||||
weaponData[i].ammoSlot = true;
|
||||
weaponData[i].melee = params[2] ? true:false;
|
||||
return i;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL TFC_cwpn_dmg(AMX *amx, cell *params){ // wid,att,vic,dmg,hp=0
|
||||
int weapon = params[1];
|
||||
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){ // only for custom weapons
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int att = params[2];
|
||||
if (att<1||att>gpGlobals->maxClients){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vic = params[3];
|
||||
if (vic<1||vic>gpGlobals->maxClients){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dmg = params[4];
|
||||
if ( dmg<1 ){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aim = params[5];
|
||||
if ( aim < 0 || aim > 7 ){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CPlayer* pAtt = GET_PLAYER_POINTER_I(att);
|
||||
CPlayer* pVic = GET_PLAYER_POINTER_I(vic);
|
||||
|
||||
pVic->pEdict->v.dmg_inflictor = NULL;
|
||||
pAtt->saveHit( pVic , weapon , dmg, aim );
|
||||
|
||||
if ( !pAtt ) pAtt = pVic;
|
||||
int TA = 0;
|
||||
if ( (pVic->pEdict->v.team == pAtt->pEdict->v.team ) && ( pVic != pAtt) )
|
||||
TA = 1;
|
||||
MF_ExecuteForward ( iFDamage, pAtt->index, pVic->index, dmg, weapon, aim, TA );
|
||||
|
||||
if ( pVic->IsAlive() )
|
||||
return 1;
|
||||
|
||||
pAtt->saveKill(pVic,weapon,( aim == 1 ) ? 1:0 ,TA);
|
||||
MF_ExecuteForward ( iFDeath, pAtt->index, pVic->index, weapon, aim, TA );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL TFC_cwpn_shot(AMX *amx, cell *params){ // player,wid
|
||||
int index = params[1];
|
||||
if (index<1||index>gpGlobals->maxClients){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int weapon = params[2];
|
||||
if ( weapon < TFCMAX_WEAPONS-TFCMAX_CUSTOMWPNS ){
|
||||
MF_RaiseAmxError(amx,AMX_ERR_NATIVE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
|
||||
pPlayer->saveShot(weapon);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL TFC_IsMelee(AMX *amx, cell *params){ // player,wid
|
||||
int weapon = params[1];
|
||||
if ( weapon < 1 || weapon >= TFCMAX_WEAPONS ){
|
||||
@ -490,11 +396,6 @@ AMX_NATIVE_INFO base_Natives[] = {
|
||||
{"TFC_IsMelee", TFC_IsMelee},
|
||||
{"TFC_UserKill" , TFC_UserKill},
|
||||
|
||||
// Custom Weapon Support
|
||||
{ "TFC_reg_custom_wpn", TFC_register_cwpn },
|
||||
{ "TFC_custom_wpn_dmg", TFC_cwpn_dmg },
|
||||
{ "TFC_custom_wpn_shot", TFC_cwpn_shot },
|
||||
|
||||
{"TFC_SetPDdata", TFC_SetPDdata },
|
||||
//******************* 19 :)
|
||||
{NULL, NULL}
|
||||
|
Reference in New Issue
Block a user