Quote:
Originally Posted by PawnHunter
Use a low interval timer or use OnPlayerUpdate.
I think you should use something like this.
PHP код:
// In filterscript init or gamemodeinit
SetTimer("UpdatePlayerNametag", 50, true);
forward UpdatePlayersNametag();
public UpdatePlayersNametag()
{
for(new i = GetPlayerPoolSize(); i > -1; i--)
{
if(IsPlayerConnected(playerid))
{
UpdatePlayerLabel(playerid);
}
}
return 1;
}
stock UpdatePlayerLabel(playerid)
{
new Float:pHealth;
new Float:pArmour;
GetPlayerHealth(playerid, pHealth);
GetPlayerArmour(playerid, pArmour);
new naem[MAX_PLAYER_NAME];
GetPlayerName(playerid, naem, sizeof(naem));
format(stc,sizeof(stc),"\n\n\n{FFFFFF}%s\n{FF4040}%.0f/{9698FE}%.0f", naem, pHealth, pArmour);
Update3DTextLabelText(PlayerLabel[playerid], 0xFFFFFFFF, stc);
return 1;
}
|
Should've used SetTimerEx.