SA-MP Forums Archive
Help Damage CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help Damage CMD (/showthread.php?tid=653681)



Help Damage CMD - bookknp - 10.05.2018

hello guys, im trying to make a command that when you receive 1 point of damage Stop SetTimerEx, can someone help me ??

Код:
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
 	{
	}



Re: Help Damage CMD - GTLS - 10.05.2018

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.


Re: Help Damage CMD - bookknp - 10.05.2018

Quote:
Originally Posted by GTLS
Посмотреть сообщение
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.
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;
}



Re: Help Damage CMD - bookknp - 10.05.2018

Quote:
Originally Posted by bookknp
Посмотреть сообщение
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;
}
how can I make it to show only 1 SendClientMessage??


Re: Help Damage CMD - GTLS - 13.05.2018

What do you mean by Show only 1 Message? I