Textdraw timer not work - 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 timer not work (
/showthread.php?tid=557661)
Textdraw timer not work -
AgusZ - 14.01.2015
how to fix this ? this textdraw not moving
Код:
public OnPlayerSpawn(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new string[128];
format(string,sizeof(string),"~b~Score: ~y~%d ~b~Ping: ~y~%d ~b~FPS: ~y~%d ~b~Players: ~y~%d ~b~Skin: ~y~%d",GetPlayerScore(playerid),GetPlayerPing(playerid),GetPlayerFPS(playerid),GetOnLinePlayers(),GetPlayerSkin(playerid));
TextDrawSetString(TextdrawInfo[playerid], string);
TextDrawShowForPlayer(playerid, TextdrawInfo[playerid]);
SetTimer("TexdrawInfo", 1000, 1);
}
}
Re: Textdraw timer not work -
HY - 14.01.2015
pawn Код:
public OnPlayerSpawn(playerid)
{
new string[128];
format(string,sizeof(string),"~b~Score: ~y~%d ~b~Ping: ~y~%d ~b~FPS: ~y~%d ~b~Players: ~y~%d ~b~Skin: ~y~%d",GetPlayerScore(playerid),GetPlayerPing(playerid),GetPlayerFPS(playerid),GetOnLinePlayers(),GetPlayerSkin(playerid));
TextDrawSetString(TextdrawInfo[playerid], string);
TextDrawShowForPlayer(playerid, TextdrawInfo[playerid]);
SetTimer("TexdrawInfo", 1000, 1);
return 1;
}
You don't need to use loop, because you only need to show for player. Else, when a player get spawned, that textdraw will can be showed by all players. Not spawned players, etc.
And don't forget to show code in Textdraw Info. Try to set timer to 2 seconds (2000) because will be a little bit lagg with 1000.