Textdraw for wounded players.
#1

Hello,
Ive scripted a little script for players that has below 20 hp a red pallete textdraw and a text on thier screen,
The thing is I want them to recieve a two lines message when they reach 20 HP I already scripted it the problem is that the client message is spamming if they have 20 HP i want them to recieve the client message only once here is my code:
Код:
public blood(playerid)
{
	new Float:HP;
	GetPlayerHealth(playerid,HP);
	if(HP <= 20)
	{
	GameTextForPlayer(playerid,"~w~You've been criticaly wounded!",2000,6);
    SendClientMessage(playerid, COLOR_LIGHTRED, "** Shooting skills set to - low");
	SendClientMessage(playerid, COLOR_LIGHTRED, "** Combat skills set to - low");
	TextDrawShowForPlayer(playerid,Textdraw5);
	}
	else
	{
	TextDrawHideForPlayer(playerid,Textdraw5);
	}
I would be glad if someone could help or fix my code, Thanks in advance.
Reply
#2

pawn Код:
new
    bool:PlayerWounded[MAX_PLAYERS char]
;

//(...)

public blood(playerid)
{
    new Float:HP;
    GetPlayerHealth(playerid,HP);
    if(HP <= 20)
    {
        if (!PlayerWounded{playerid})
        {
            PlayerWounded{playerid} = true;
            GameTextForPlayer(playerid,"~w~You've been criticaly wounded!",2000,6);
            SendClientMessage(playerid, COLOR_LIGHTRED, "** Shooting skills set to - low");
            SendClientMessage(playerid, COLOR_LIGHTRED, "** Combat skills set to - low");
            TextDrawShowForPlayer(playerid,Textdraw5);
        }
    }
    else
    {
        if (PlayerWounded{playerid})
        {
             PlayerWounded{playerid} = false;
             TextDrawHideForPlayer(playerid,Textdraw5);
        }
    }
}
Reply
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
pawn Код:
new
    bool:PlayerWounded[MAX_PLAYERS char]
;

//(...)

public blood(playerid)
{
    new Float:HP;
    GetPlayerHealth(playerid,HP);
    if(HP <= 20)
    {
        if (!PlayerWounded{playerid})
        {
            PlayerWounded{playerid} = true;
            GameTextForPlayer(playerid,"~w~You've been criticaly wounded!",2000,6);
            SendClientMessage(playerid, COLOR_LIGHTRED, "** Shooting skills set to - low");
            SendClientMessage(playerid, COLOR_LIGHTRED, "** Combat skills set to - low");
            TextDrawShowForPlayer(playerid,Textdraw5);
        }
    }
    else
    {
        if (PlayerWounded{playerid})
        {
             PlayerWounded{playerid} = false;
             TextDrawHideForPlayer(playerid,Textdraw5);
        }
    }
}
Thank you very much.
You helped me alot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)