Need help about save money
#1

I added a money saving system in my server, but it doesn't work.

It save the informations with the ID of the player and not with the name.
I mean if ID0 left with Money=1500, the next ID0 will spawn with Money=1500, even if the don't have the same name.

And if the player "NAME1" was ID 0 and relog as ID 5, he will get the money of the old's ID 5.


Here are the scripts.
Код:
new Float:positionx;
new Float:positiony;
new Float:positionz;



public OnPlayerConnect(playerid)
  {
	LoadStats(playerid);
	return 1;
  }
  
public OnPlayerDisconnect(playerid, reason)
{
	new Float:x;
	new Float:y;
	new Float:z;

	GetPlayerPos(playerid,x,y,z);
	positionx = x;
	positiony = y;
	positionz = z;
	
	GetPlayerPCash(playerid);

	if (!dini_Exists(FileStats(playerid)))
	{
		dini_Create(FileStats(playerid));
	}

	SaveStats(playerid);
	return 1;
}





Player(playerid)
{
 new player[MAX_PLAYER_NAME];
 GetPlayerName(playerid, player, sizeof(player));
 return player;
}

FileStats(playerid)
{
  new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
  return a;
}

SaveStats(playerid)
{
  dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
  dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
  dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
  dini_IntSet(FileStats(playerid), "Pcash", GetPlayerPCash(playerid));

}

LoadStats(playerid)
{
  positionx = dini_Int(FileStats(playerid), "PositionX");
  positiony = dini_Int(FileStats(playerid), "PositionY");
  positionz = dini_Int(FileStats(playerid), "PositionZ");
  playerid = dini_Int(FileStats(playerid), "Pcash");
}
How can it be fixed ??
Reply


Messages In This Thread
Need help about save money - by Alice[WS] - 13.08.2009, 13:32
Re: Need help about save positions and money - by MenaceX^ - 13.08.2009, 13:37
Re: Need help about save money - by Alice[WS] - 13.08.2009, 13:51
Re: Need help about save money - by RaFsTar - 13.08.2009, 14:23

Forum Jump:


Users browsing this thread: 1 Guest(s)