[SOLVED] Again problem with saving money -
Flashy - 02.06.2010
Hello,
I am really angry of this shit xD I got again a problem about the money.
-->When I give me money it shows my that my money is increasing but when I type /stats I donґt see my actual money. It shows me the moeny I have before I give me money.
And when I disconnect the money wonґt save -.-
ANd sure when I connect the money which is in my user file appears.
Can somebody, somebody who knows the problem help me?? I can give him all he want. Credits on my server and so on but HELP ME xDDD
pawn Код:
forward SetPlayerMoney(playerid,amount);
pawn Код:
public OnPlayerConnect(playerid)
{
if(dini_Exists(PlayerFile))
{
if(playerIP[50] == playerIp[49])
{
SendClientMessage(playerid, COLOR_GREEN, "You have been automatically logged in! Welcome back to the server.");
PlayerInfo[playerid][Registered] = 1;
PlayerInfo[playerid][LoggedIn] = 1;
PlayerInfo[playerid][AdminLevel] = dini_Int(PlayerFile, "AdminLevel");
PlayerInfo[playerid][Kills] = dini_Int(PlayerFile, "Kills");
PlayerInfo[playerid][Deaths] = dini_Int(PlayerFile, "Deaths");
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, dini_Int(PlayerFile,"Money"));
}
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], PlayerFile[50];
GetPlayerName(playerid,name,sizeof(name));
format(PlayerFile,sizeof(PlayerFile),"/users/%s.ini",name);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, dini_Int(PlayerFile,"Money"));
pawn Код:
public SetPlayerMoney(playerid,amount)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,amount);
return 1;
}
public OnPlayerUpdate(playerid)
{
new PlayerFile[128];
format(PlayerFile, sizeof(PlayerFile), "/users/%s.ini", playerid);
GivePlayerMoney(playerid, dini_Int(PlayerFile,"Money"));
}
Re: Again problem with saving money -
Flashy - 02.06.2010
If someone got an idea please help.
I donґt care if I bump. I just want this solved >.>
Re: Again problem with saving money -
Infinity - 02.06.2010
Код:
OnPlayerDisconnect(playerid){
GetPlayerName(playerid,name,sizeof(name));
format(PlayerFile,sizeof(PlayerFile),"/users/%s.ini",name)
dini_IntSet(udb_encode([ENTER LOCATION OF FILE]), "Money", money[playerid]);
Re: Again problem with saving money -
Flashy - 02.06.2010
NVM!
Thanks Infinity
Flo_White have explain me that and teh result was that I donґt save the money when I disconnect and get ingame money. All is fixed now.
For further notice the final script codes:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], PlayerFile[50];
GetPlayerName(playerid,name,sizeof(name));
format(PlayerFile,sizeof(PlayerFile),"/users/%s.ini",name);
dini_IntSet(PlayerFile,"Money",GetPlayerMoney(playerid));
pawn Код:
public OnPlayerUpdate(playerid)
{
new name[MAX_PLAYER_NAME], PlayerFile[50];
GetPlayerName(playerid,name,sizeof(name));
format(PlayerFile,sizeof(PlayerFile),"/users/%s.ini",name);
dini_IntSet(PlayerFile,"Money",GetPlayerMoney(playerid));
}