Need help regarding 3d labels - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help regarding 3d labels (
/showthread.php?tid=102796)
Need help regarding 3d labels -
Striker_Moe - 17.10.2009
Код:
public hpcheck(playerid)
{
new Float:health;
GetPlayerHealth(playerid,health);
if (health < 18.0)
{
SetPlayerDrunkLevel(playerid,10000);
new wounded = Create3DTextLabel("Wounded",COLOR_YELLOW,0.0,0.0,0.0,40.0,0);
Attach3DTextLabelToPlayer(wounded, playerid, 0, 0, 0, 0);
return 1;
}
else if (health < 9.0)
{
SetPlayerDrunkLevel(playerid,50000);
new hwounded = Create3DTextLabel("HEAVILY Wounded",COLOR_RED,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(hwounded, playerid, 0, 0, 0, 0);
return 1;
}
else if (health > 18.0)
{
SetPlayerDrunkLevel(playerid,0);
}
return 1;
}
Problem here is - it attaches the label to all players. Why?
Re: Need help regarding 3d labels -
V1ceC1ty - 17.10.2009
you need SetTimerEx
https://sampwiki.blast.hk/wiki/SetTimerEx
Re: Need help regarding 3d labels -
Striker_Moe - 17.10.2009
I have this at OnPlayerConnect:
SetTimerEx("hpcheck",2000,true,"i",playerid);
Re: Need help regarding 3d labels -
Beaver07 - 17.10.2009
1st of all if you have that public on a timer i'm sure somebody's game will eventually crash as every time you call it and their health is below what you have set it will create a new 3d text everytime so why not just create 1 3dtext like
new 3DText:Player[MAX_PLAYERS]
then on player spawn just create their 3dtext and just give it a blank name so you can't see it untill necessary and just update their 3d text instead of creating new ones..
also change the public from playerid to
Код:
for(new i=0; i < MAX_PLAYERS; i++)
{
so then it will call upon every player but set it to those only with hp less than wat ever