14.10.2016, 08:40
I have a problem with my PlayerTextDraw and I made a filterscript to try and debug it, but nothing I tried worked so I figured why not ask the good old SAMP community for help.
The problem is this; executing /showit shows the text draw as "0" for one second, but when updated it scrambles a few numbers which I can see on the screen and vanishes in the next second. I placed a "SendClientMessage" for debugging, if maybe the variable didn't work right, but it all works as it should.. Except the updating, ofcourse.
Any suggestions that might help? Code below
The problem is this; executing /showit shows the text draw as "0" for one second, but when updated it scrambles a few numbers which I can see on the screen and vanishes in the next second. I placed a "SendClientMessage" for debugging, if maybe the variable didn't work right, but it all works as it should.. Except the updating, ofcourse.
Any suggestions that might help? Code below
Код:
#include <a_samp> #include <zcmd> new PlayerText:timer,time[MAX_PLAYERS],ptimer[MAX_PLAYERS]; public OnFilterScriptInit() { for(new i = 0; i < MAX_PLAYERS; i++) ptimer[i] = SetTimerEx("UpdateShit",1000,true,"i",i); return 1; } public OnFilterScriptExit() { for(new i = 0; i < MAX_PLAYERS; i++) KillTimer(ptimer[i]); return 1; } forward UpdateShit(playerid); public UpdateShit(playerid) { time[playerid]++; new string[10]; format(string,sizeof(string),"%d t",time[playerid]); SendClientMessage(playerid,-1,string); PlayerTextDrawSetString(playerid,timer,string); PlayerTextDrawShow(playerid,timer); return 1; } CMD:showit(playerid) { timer = CreatePlayerTextDraw(playerid,320,19,"0"); PlayerTextDrawShow(playerid,timer); return 1; } CMD:removeit(playerid) return PlayerTextDrawDestroy(playerid,timer);