06.03.2012, 16:36
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:
I also maked command to reset it, but it don't resets my textdraw:
Код:
//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; }
Код:
if (strcmp("/rst", cmdtext, true, 10) == 0) { KillTimer(DrawInfoTmr[playerid]); TextDrawHideForPlayer(playerid, DrawInfo[playerid]); DrawInfoTmr[playerid] = SetTimerEx("UpdateInfo", 50, 1, "i", playerid); return 1; }