[HELP] My stats wont save...
#1

So, this is the problem...
When I register a user and want to edit my cash ammount or put myself to a new Rank, I exit the game, edits my %s.ini, saves it and joins my server again.
Nothing changed, my cash is still at $0 and rank is also at 0...

I can't get it to save the stats and keep it, it gets deleted after disconnect.

Here is my register system:

http://pastebin.com/f605c81d2

I've tried to get help about this for a long time ago, I'll try again.

Thanks for taking your time
Reply
#2

Change OnPlayerUpdate, that's already a callback being called by SA-MP. Make it something like OnPlayerSave.

Do the print test to see where in OnPlayerLogin it fails.



Example of Print Test:
Let's say this is your code
pawn Код:
public OnPlayerConnect(playerid)
{
  new tmp[128];
  GetPlayerName(playerid,tmp,sizeof(tmp));
  if(!strcmp(tmp,"Joe_Staff",false))
  {
    SendClientMessageToAll(0xFF0000FF,"All hail! Your lord has cometh!");
  }
  return 1;
}
And for some reason when you join it doesn't say the message you want it to, so we're going to place print functions through out the code
pawn Код:
public OnPlayerConnect(playerid)
{
  new tmp[128];
  print("print test 1");
  GetPlayerName(playerid,tmp,sizeof(tmp));
  print("print test 2");
  if(!strcmp(tmp,"Joe_Staff",false))
  {
    print("print test 3");
    SendClientMessageToAll(0xFF0000FF,"All hail! Your lord has cometh!");
    print("print test 4");
  }
  print("print test 5");
  return 1;
}
Now when you run the script the log will show how far 'print test' gets to.
In this example the log will only show this
Код:
print test 1
So that means something is wrong with the line immediately following it
pawn Код:
GetPlayerName(playerid,tmp,sizeof(tmp));
So now you know where the error lies, it's up to you to find what's wrong with it!
In this case, sizeof(tmp) is 128, which is far too large to be used in the GetPlayerName function which causes a script hault

This test can be converted to check what a variable equals before and after a function (like say, PlayerInfo[playerid][cash])
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)