Textdraw disappears - 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 disappears (
/showthread.php?tid=323681)
Textdraw disappears -
Daslee - 06.03.2012
Hello. I just started making a new samp server from 0. And now i need to draw player info every 50 miliseconds, i created textdraw and timer after he logins. And when i playing in my server it shows that information for about 1-2 minutes and then disappears. I can't find my problem, so here is my codes, maybe someone knows the problem:
Код:
//At the top of code:
new Text:Box[MAX_PLAYERS];
new Text:DrawInfo[MAX_PLAYERS];
new DrawInfoTmr[MAX_PLAYERS];
//After player login:
DrawInfoTmr[playerid] = SetTimerEx("UpdateInfo", 50, 1, "i", playerid);
//UpdateInfo:
forward UpdateInfo(playerid);
public UpdateInfo(playerid)
{
if(IsLogged[playerid] == true){
TextDrawDestroy(DrawInfo[playerid]);
TextDrawFont(Box[playerid], 2);
TextDrawColor(Box[playerid], COLOR_BLUE);
Box[playerid] = TextDrawCreate(-5.0, 0.0, "I");
TextDrawUseBox(Box[playerid], 1);
TextDrawShowForPlayer(playerid, Box[playerid]);
new infoText[256];
format(infoText, sizeof(infoText), "Pinigai: %iLt Licenzijos: %0.1f", PlayerInfo[playerid][Pinigai], PlayerInfo[playerid][Licenzijos]);
DrawInfo[playerid] = TextDrawCreate(205.0, 0.5, infoText);
TextDrawColor(DrawInfo[playerid], COLOR_YELLOW);
TextDrawSetShadow(DrawInfo[playerid], 0);
TextDrawFont(DrawInfo[playerid], 2);
TextDrawShowForPlayer(playerid, DrawInfo[playerid]);
}
return 1;
}
I also maked command to reset it, but it don't resets my textdraw:
Код:
if (strcmp("/rst", cmdtext, true, 10) == 0)
{
KillTimer(DrawInfoTmr[playerid]);
TextDrawHideForPlayer(playerid, DrawInfo[playerid]);
DrawInfoTmr[playerid] = SetTimerEx("UpdateInfo", 50, 1, "i", playerid);
return 1;
}