SA-MP Forums Archive
Saving Money - 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)
+--- Thread: Saving Money (/showthread.php?tid=360246)



Saving Money - Nix92 - 17.07.2012

Hello guys, i am trying to figure out something, whenever i give money ingame to myself, i just get it, and 2 secs after, its gone, its not staying in my pocket, means, its not saving, any ideas what should i do to fix this one? Cause i am really lost, i am not much experienced, still learning, but this is pain for me


Re: Saving Money - Ballu Miaa - 17.07.2012

Are you saving the player data somewhere? Do any account gets created/register?


Re: Saving Money - Nix92 - 17.07.2012

Yea, everything works just fine, accounts gets saved, but when i put money on server to myself, its just gone after a sec..


Re: Saving Money - Ballu Miaa - 17.07.2012

Do you have a function called 'SetPlayerCash' under OnPlayerSpawn callback?


Re: Saving Money - Nix92 - 17.07.2012

public OnPlayerSpawn(playerid)
{
SetRealMoney(playerid, ScriptMoney[playerid]);

thats it.


Re: Saving Money - Ballu Miaa - 17.07.2012

Quote:
Originally Posted by Nix92
Посмотреть сообщение
public OnPlayerSpawn(playerid)
{
SetRealMoney(playerid, ScriptMoney[playerid]);

thats it.
Now search for 'SetRealMoney' function/stock in your whole script. Paste it over here!

Next time for pawn codes use [ pawn ] [ /pawn ] tags.


Re: Saving Money - [BOPE]Seu._.Madruga - 17.07.2012

pawn Код:
#include <dini>

public OnPlayerConnect(playerid)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,aname,sizeof(aname));
    if(dini_Exists("aname.ini"))
    {
        SendClientMessage(playerid,-1,"[x] Logue-se para carregar sua conta...");
    }
    else if(!dini_Exists("aname.ini"))
    {
        dini_Create("aname.ini");
        dini_IntSet("aname.ini", "Dinheiro", 0);
    }
    return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,aname,sizeof(aname));
    dini_IntSet("aname.ini","Dinheiro",GetPlayerMoney(playerid));
    return 1;
}
public OnPlayerSpawn(playerid)
{
    new aname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,aname,sizeof(aname));
    GivePlayerMoney(playerid,dini_Int("aname.ini","Dinheiro"));
    return 1;
}
Код:
Meus Projetos
¤ GameModes ¤
Brasil City Virtual 0.3e ---- 40 % Completed »» Forum: BcvGames.forumbrasil.net »» Site: Gta Lokidoido »» Servidor: [0.3e] • Brasil City Virtual • [RPG v1.0] »» Equipe: Murilo / dPlaYer / Malakas / Bruno_. e Emerson_.