SA-MP Forums Archive
Help This timer is stupid :S - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help This timer is stupid :S (/showthread.php?tid=157892)



Help This timer is stupid :S - Lorenc_ - 08.07.2010

Hi everybody, i was doing up my xp system and suddenly i realized something wrong.

When i Log in it shows the Xp Textdraw But when i /q and rejoin the textdraw appears still without being logged in.
I tryed killing the timer at OnPlayerDisconnect but it just dont work for some reason...

Ok ill point out my codes..

pawn Код:
XPTDLoad(playerid);
SetTimerEx("PlayerXPTimer", 100, true, "d", playerid);
PlayerInfo[playerid][pExp] = dini_Int(file,"XP");
^^ where the login part is..

pawn Код:
forward PlayerXPTimer(playerid);
public PlayerXPTimer(playerid)
{
   new string[128];
   TextDrawHideForPlayer(playerid, TDSTATS[playerid]);
   format(string, sizeof(string), "~p~XP:%d", GetPlayerXP(playerid));
   TextDrawSetString(TDSTATS[playerid], string);
   TextDrawShowForPlayer(playerid, TDSTATS[playerid]);
}
^^^ The Timer that contributes to the login part.

pawn Код:
KillTimer(PlayerXPTimer(playerid));
^^^ public OnPlayerDisconnect(playerid, reason)

Please help, im not sure whats wrong here.


Re: Help This timer is stupid :S - Lorenc_ - 08.07.2010

^^ yes that but when i quit and rejoin the server it still apears :/


Re: Help This timer is stupid :S - bigcomfycouch - 08.07.2010

Put this in OnPlayerDisconnect

Код:
TextDrawHideForPlayer(playerid, TDSTATS[playerid]);



Re: Help This timer is stupid :S - Lorenc_ - 08.07.2010

Quote:
Originally Posted by YogiBear
Посмотреть сообщение
Put this in OnPlayerDisconnect

Код:
TextDrawHideForPlayer(playerid, TDSTATS[playerid]);
YEA THATS THE ONE TY I FORGOT TO ADD THAT XD THANKS :P

I was about to edit the topic that i fixed it but mehh
Gave me a replie xD


Re: Help This timer is stupid :S - CAR - 08.07.2010

This was my Timer isn't it? whatever, here is what you need:

Top:
pawn Код:
XPTimer[MAX_PLAYERS];
Login:
pawn Код:
XPTDLoad(playerid);
XPTimer[playerid] = SetTimerEx("PlayerXPTimer", 100, true, "d", playerid);
PlayerInfo[playerid][pExp] = dini_Int(file,"XP");
The timer: (same)
pawn Код:
forward PlayerXPTimer(playerid);
public PlayerXPTimer(playerid)
{
   new string[128];
   TextDrawHideForPlayer(playerid, TDSTATS[playerid]);
   format(string, sizeof(string), "~p~XP:%d", GetPlayerXP(playerid));
   TextDrawSetString(TDSTATS[playerid], string);
   TextDrawShowForPlayer(playerid, TDSTATS[playerid]);
}
Disconnect:
pawn Код:
KillTimer(XPTimer[playerid]);
TextDrawHideForPlayer(playerid, TDSTATS[playerid]);