XP Bar not updating - 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 Bar not updating (
/showthread.php?tid=655401)
XP Bar not updating -
div - 20.06.2018
removed
Re: XP Bar not updating -
XStormiest - 20.06.2018
For that you need a timer or use OnPlayerUpdate but I'd rather recommand a timer since OnPlayerUpdate gets called 100 times per ms
Код:
forward yournameofthetimer();
public yournameofthetimer()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new string[30];
format(string, sizeof(string), "%5d", pInfo[playerid][pXP]);
PlayerTextDrawSetString(playerid, textdrawhere, string);
}
return 1;
}
You'll need to call it with SetTimer on a loop.
Re: XP Bar not updating -
Ada32 - 20.06.2018
or update the textdraw when it actually gets updated
Re: XP Bar not updating -
XStormiest - 20.06.2018
It's faster with a timer this way he would'n need to update it everytime he wants to create something related to xp.
Re: XP Bar not updating -
div - 20.06.2018
undefined symbol "playerid" in both sentences..
Re: XP Bar not updating -
XStormiest - 20.06.2018
Код:
forward yournameofthetimer();
public yournameofthetimer()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
new string[30];
format(string, sizeof(string), "%5d", pInfo[playerid][pXP]);
PlayerTextDrawSetString(playerid, textdrawhere, string);
}
return 1;
}
Re: XP Bar not updating -
div - 20.06.2018
where to add the timer??
Re: XP Bar not updating -
div - 20.06.2018
Код:
CMD:xpls(playerid, params[])
{
pInfo[playerid][pXP] = 25000;
SetTimer("UpdateXP", 500, true);
return 1;
}
here's what i did.. it's not working bro..
Re: XP Bar not updating -
div - 20.06.2018
idk.. i type /xpls.. but it doesn't update my XP..
Do i need any plugin or include for this?
Re: XP Bar not updating -
XStormiest - 20.06.2018
Did you also changed the name of the timer to UpdateXP?