Value doesnt saves OnPlayerDisconnect..
#1

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;
}
Reply
#2

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.
Reply
#3

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.
Reply
#4

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.
Reply
#5

Sorry i don't know how dini works.
I move to y_ini now.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)