05.10.2013, 06:13
as the tittle say , i got problem after put code this
I want if someone shoot the player and the armor is decreased first , and if armor = 0. the health will decreased
But i test it , if i shoot the people using armor. Armor and Health is decreased
What should i do on that code ?
Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
if(issuerid != INVALID_PLAYER_ID)
{
new Float:stat[2];
GetPlayerHealth(playerid, stat[0]);
GetPlayerArmour(playerid, stat[1]);
if(stat[1] >= 1 )
{
if(weaponid == 1) SetPlayerHealth(playerid,stat[1]-10);
if(weaponid == 2) SetPlayerHealth(playerid,stat[1]-20);
if(weaponid == 3) SetPlayerHealth(playerid,stat[1]-20);
if(weaponid == 4) SetPlayerHealth(playerid,stat[1]-50);
if(weaponid == 5) SetPlayerHealth(playerid,stat[1]-30);
if(weaponid == 6) SetPlayerHealth(playerid,stat[1]-25);
if(weaponid == 7) SetPlayerHealth(playerid,stat[1]-15);
if(weaponid == 8) SetPlayerHealth(playerid,stat[1]-75);
if(weaponid == 9) SetPlayerHealth(playerid,stat[1]-50);
if(weaponid == 16) SetPlayerHealth(playerid,stat[1]-500);
if(weaponid == 22) SetPlayerHealth(playerid,stat[1]-25);
if(weaponid == 23) SetPlayerHealth(playerid,stat[1]-25);
if(weaponid == 24) SetPlayerHealth(playerid,stat[1]-75);
if(weaponid == 27) SetPlayerHealth(playerid,stat[1]-75);
if(weaponid == 28) SetPlayerHealth(playerid,stat[1]-30);
if(weaponid == 29) SetPlayerHealth(playerid,stat[1]-35);
if(weaponid == 30) SetPlayerHealth(playerid,stat[1]-45);
if(weaponid == 31) SetPlayerHealth(playerid,stat[1]-45);
if(weaponid == 32) SetPlayerHealth(playerid,stat[1]-30);
if(weaponid == 34) SetPlayerHealth(playerid,stat[1]-100);
if(weaponid == 35) SetPlayerHealth(playerid,stat[1]-100);
if(weaponid == 38) SetPlayerHealth(playerid,stat[1]-100);
}
else if(stat[1] == 0)
{
if(weaponid == 1) SetPlayerHealth(playerid,stat[0]-10);
if(weaponid == 2) SetPlayerHealth(playerid,stat[0]-20);
if(weaponid == 3) SetPlayerHealth(playerid,stat[0]-20);
if(weaponid == 4) SetPlayerHealth(playerid,stat[0]-50);
if(weaponid == 5) SetPlayerHealth(playerid,stat[0]-30);
if(weaponid == 6) SetPlayerHealth(playerid,stat[0]-25);
if(weaponid == 7) SetPlayerHealth(playerid,stat[0]-15);
if(weaponid == 8) SetPlayerHealth(playerid,stat[0]-75);
if(weaponid == 9) SetPlayerHealth(playerid,stat[0]-50);
if(weaponid == 16) SetPlayerHealth(playerid,stat[0]-500);
if(weaponid == 22) SetPlayerHealth(playerid,stat[0]-25);
if(weaponid == 23) SetPlayerHealth(playerid,stat[0]-25);
if(weaponid == 24) SetPlayerHealth(playerid,stat[0]-75);
if(weaponid == 27) SetPlayerHealth(playerid,stat[0]-75);
if(weaponid == 28) SetPlayerHealth(playerid,stat[0]-30);
if(weaponid == 29) SetPlayerHealth(playerid,stat[0]-35);
if(weaponid == 30) SetPlayerHealth(playerid,stat[0]-45);
if(weaponid == 31) SetPlayerHealth(playerid,stat[0]-45);
if(weaponid == 32) SetPlayerHealth(playerid,stat[0]-30);
if(weaponid == 34) SetPlayerHealth(playerid,stat[0]-100);
if(weaponid == 35) SetPlayerHealth(playerid,stat[0]-100);
if(weaponid == 38) SetPlayerHealth(playerid,stat[0]-100);
}
}
return 1;
}
But i test it , if i shoot the people using armor. Armor and Health is decreased
What should i do on that code ?


