Help Damage CMD
#1

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
 	{
	}
Reply
#2

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.
Reply
#3

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;
}
Reply
#4

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??
Reply
#5

What do you mean by Show only 1 Message? I
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)