SA-MP Forums Archive
SA:MP Texdraw Bug +Rep, Please :D Thats urgent - 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: SA:MP Texdraw Bug +Rep, Please :D Thats urgent (/showthread.php?tid=578515)



SA:MP Texdraw Bug +Rep, Please :D Thats urgent - Rodri99 - 20.06.2015

Hello all,
I have scripted on my GM a textdraw, what screen the players online, it works, but players online dont update onplayerdisconnect, example in the server are 34 players enter one more player and the textdraw pass to 35/100, but if a player leave the server, so 34 players again, the textdraw remain on 35 players untill new player join and the textdraw get update.
How can i update the textdraw also when player disconnect ?

My script:
OnPlayerConnect{

new strings[15];
format(strings, 15, "%d/100",GetOnLinePlayers());
TextDrawSetString(players, strings);
TextDrawShowForPlayer(playerid, players);

return 1;
}


Thanks to all ,
Rodrigo Dionigi aka 'Rodri'


Re: SA:MP Texdraw Bug +Rep, Please :D Thats urgent - Hessu - 20.06.2015

Define strings[15] on top of your script and put a timer under OnGameModeInit that runs like once a second and in your timer function you put
pawn Код:
format(strings, 15, "%d/100",GetOnLinePlayers());
TextDrawSetString(players, strings);



Re: SA:MP Texdraw Bug +Rep, Please :D Thats urgent - X337 - 20.06.2015

Add this code under OnPlayerDisconnect.
Код:
new strings[15];
format(strings, 15, "%d/100",GetOnLinePlayers());
TextDrawSetString(players, strings);
TextDrawShowForPlayer(playerid, players);