Textdraw for wounded players. - 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: Textdraw for wounded players. (
/showthread.php?tid=568697)
Textdraw for wounded players. -
AlterEGO - 24.03.2015
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.
Re: Textdraw for wounded players. -
Misiur - 24.03.2015
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);
}
}
}
Re: Textdraw for wounded players. -
AlterEGO - 24.03.2015
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