SA-MP Forums Archive
Xp System helpppp! - 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: Xp System helpppp! (/showthread.php?tid=590249)



Xp System helpppp! - ironmen - 27.09.2015

I have made an xp system and everything works!
except...
The Xp TextDraw shows only for the first player that joins!
Help me!
Code:
Код:
public OnPlayerConnect(playerid)
{
	SetTimer("xpse", 2, 1);
}
public xpse(playerid)
{
 	new newxp[246];
    format(newxp, sizeof(newxp), "Xp: %d", XP[playerid]);
    TextDrawSetString(XPS, newxp);
    TextDrawShowForPlayer(playerid, XPS);
	return 1;
}
It compiles without any error!
Thanks!
IronMen


Re: Xp System helpppp! - CalvinC - 27.09.2015

Use SetTimerEx.
pawn Код:
public OnPlayerConnect(playerid)
{
    SetTimerEx("xpse", 2, 1, "i", playerid);
}
Also you don't need "newxp" to have the size of 246, max 15 is needed.


Re: Xp System helpppp! - Vince - 27.09.2015

This is a great way to overload your server. You're not killing the timer when the player disconnects and you have it set to an interval of 2 milliseconds. For your information: the blink of an eye is about 250 milliseconds.


Re: Xp System helpppp! - ironmen - 28.09.2015

Thanks!
I'll try it now!