[HELP] My stats wont save...
#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


Messages In This Thread
[HELP] My stats wont save... - by FreddeN - 31.01.2010, 22:03
Re: [HELP] My stats wont save... - by Joe Staff - 31.01.2010, 23:59

Forum Jump:


Users browsing this thread: 1 Guest(s)