SA-MP Forums Archive
[HELP] Bank + Register = ?! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Bank + Register = ?! (/showthread.php?tid=125203)



[HELP] Bank + Register = ?! - FreddeN - 02.02.2010

Hello guys, good news, I fixed my register system, it daves my stats, but...

I've installed a Bank System, when I put some money in my bank account it don't save, it gets removed after disconnect.

Here is my script, it's not that big, please, if you can find the problem I would he happy

http://pastebin.com/f3861ffd0

Thanks


Re: [HELP] Bank + Register = ?! - LuxurioN™ - 02.02.2010

Of course it would not save. You have not specified it was to save money when the player leaves the server!

Try this (Not Tested and Only Save Player Cash!):

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
SaveCash(playerid);
IsLogged[playerid] = 0;
return 1;
}
pawn Код:
stock SaveCash(playerid)
{
if(IsLogged[playerid] == 1)
{
new name[MAX_PLAYER_NAME];
new file[128];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(fexist(file))
{
dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
}
}
return 1;
}



Re: [HELP] Bank + Register = ?! - FreddeN - 02.02.2010

Quote:
Originally Posted by © Tђэ LυxυяiσN™
Of course it would not save. You have not specified it was to save money when the player leaves the server!

Try this (Not Tested and Only Save Player Cash!):

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
SaveCash(playerid);
IsLogged[playerid] = 0;
return 1;
}
pawn Код:
stock SaveCash(playerid)
{
if(IsLogged[playerid] == 1)
{
new name[MAX_PLAYER_NAME];
new file[128];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(fexist(file))
{
dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
}
}
return 1;
}
My pocket money saves, but it's the money in my bank account that wont save, PlayerInfo[Playerid][Bank], will this fix that problem?


Re: [HELP] Bank + Register = ?! - LuxurioN™ - 02.02.2010

Yes!

pawn Код:
stock SaveCash(playerid)
{
if(IsLogged[playerid] == 1)
{
new name[MAX_PLAYER_NAME];
new file[128];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(fexist(file))
{
dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
dini_IntSet(file, "Bank", PlayerInfo[Playerid][Bank]);
}
}
return 1;
}



Re: [HELP] Bank + Register = ?! - FreddeN - 02.02.2010

Quote:
Originally Posted by © Tђэ LυxυяiσN™
Yes!

pawn Код:
stock SaveCash(playerid)
{
if(IsLogged[playerid] == 1)
{
new name[MAX_PLAYER_NAME];
new file[128];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(fexist(file))
{
dini_IntSet(file, "Cash", GetPlayerMoney(playerid));
dini_IntSet(file, "Bank", PlayerInfo[Playerid][Bank]);
}
}
return 1;
}
Thanks mate, it works like a charm, have a good one