SA-MP Forums Archive
Spamming Message - 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: Spamming Message (/showthread.php?tid=319957)



Spamming Message - KeeDee - 21.02.2012

Код:
public OnPlayerUpdate(playerid)
{
    new Float:health;
    GetPlayerHealth(playerid,health);
    if(health < 20.0)
    {
    ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); // Dieing of Crack
    TogglePlayerControllable(playerid,0);
    SendClientMessage(playerid, COLOR_GREY, " You are on auto-crack mode type /suicide or Wait for EMS");
    }
	return 1;
}
Quote:

Its keep spamming the SendClientMessage(playerid, COLOR_GREY, " You are on auto-crack mode type /suicide or Wait for EMS"); How can i fix that?




Re: Spamming Message - chrism11 - 21.02.2012

use onplayertakedeath instead

http://pastebin.com/rxxYvygW

+rep if i helped


Re: Spamming Message - KeeDee - 21.02.2012

Quote:
Originally Posted by chrism11
Посмотреть сообщение
use onplayertakedeath instead

http://pastebin.com/rxxYvygW

+rep if i helped
Animation dosent apply.


Re: Spamming Message - cessil - 21.02.2012

because you have the script under OPU which gets called a lot, you need to store a variable like...

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(!playersOnCrack[playerid])
    {
        new Float:health;
        GetPlayerHealth(playerid,health);
        if(health < 20.0)
        {
            ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0); // Dieing of Crack
            TogglePlayerControllable(playerid,0);
            SendClientMessage(playerid, COLOR_GREY, " You are on auto-crack mode type /suicide or Wait for EMS");
            playersOnCrack[playerid] = 1;
        }
    }
    return 1;
}
and then unset it when they get healed or die ect.


Re: Spamming Message - KeeDee - 21.02.2012

Understand now Thanks.