CMD:class(playerid,params[]) { new STOP[MAX_PLAYERS]; new Float:health; GetPlayerHealth(playerid, health); STOP[playerid]= SetTimerEx("ClassSelection", 10000, false, "i", playerid); SendClientMessage(playerid, 0xFF0000FF,"Change of class in 10 seconds"); if( health < health-1) <-------- // I dont know if this right?? { KillTimer(STOP[playerid]); SendClientMessage(playerid, 0xFF0000FF,"You have received damages, change of class canceled"); return 1; } else { }
How can Current health be less than health-1 ever?
What you need is OnPlayerTakeDamage... https://sampwiki.blast.hk/wiki/OnPlayerTakeDamage you can stop the timer inside that function. |
public OnPlayerTakeDamage(playerid,issuerid,Float:amount,weaponid,bodypart) { if(health > amount > 1) { KillTimer(CLS[playerid]); SendClientMessage(playerid, 0xFF0000FF,"[INFO] You have received damages, change of class canceled"); } return 1; }
Very thx friend, I solve it!!! +Rep
Код:
public OnPlayerTakeDamage(playerid,issuerid,Float:amount,weaponid,bodypart) { if(health > amount > 1) { KillTimer(CLS[playerid]); SendClientMessage(playerid, 0xFF0000FF,"[INFO] You have received damages, change of class canceled"); } return 1; } |