Value doesnt saves OnPlayerDisconnect.. - 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: Value doesnt saves OnPlayerDisconnect.. (
/showthread.php?tid=382579)
Value doesnt saves OnPlayerDisconnect.. -
Benzke - 04.10.2012
Hello,
So I've encountered a error which I was not even able to fix it .. tried many ways but can't get it working..
So the problem is that I'm using the
progressbar and everything works fine.. My hunger system works good.. then as soon as I log off.. and log in back, it doesnt saves
Here, I'll give you some codes :
If you need more codes, Please do tell.
pawn Код:
public OnPlayerConnect(playerid)
{
Player[playerid][PlayerHunger] = 0;
return 1;
}
pawn Код:
OnPlayerDisconnect(playerid)
{
Player[playerid][PlayerHunger] = floatround(GetProgressBarValue(Hunger[playerid]));
dini_IntSet(string,"PlayerHunger",floatround(GetProgressBarValue(Hunger[playerid])));
return 1;
}
pawn Код:
OnPlayerSpawn(playerid)
{
SetProgressBarValue(Hunger[playerid], dini_Int(file,"PlayerHunger"));
return 1;
}
Re: Value doesnt saves OnPlayerDisconnect.. -
JaKe Elite - 04.10.2012
Why setting it to zero?
Maybe that's the cause of the problem.
Check if player has a file of PlayerHunger if doesn't then set it to 0 if he has don't set it.
Re: Value doesnt saves OnPlayerDisconnect.. -
Benzke - 04.10.2012
My hunger system works like " Filling up " which means.. when player spawns.. its empty, It fills up time by time..
@ ****** - Is that causing the error ? I have no idea why is it not working out.
Another question, should I just re-do the whole system and change it totally.
Re: Value doesnt saves OnPlayerDisconnect.. -
Roel - 04.10.2012
Quote:
Originally Posted by Romel
Why setting it to zero?
Maybe that's the cause of the problem.
Check if player has a file of PlayerHunger if doesn't then set it to 0 if he has don't set it.
|
Why that bunch of code ... you can just set it to zero.
Because if the dini load it, it will always get overwriten.
So I don't get your point.
Re: Value doesnt saves OnPlayerDisconnect.. -
JaKe Elite - 04.10.2012
Sorry i don't know how dini works.
I move to y_ini now.