SA-MP Forums Archive
Money problem? - 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: Money problem? (/showthread.php?tid=369022)



Money problem? - N0FeaR - 15.08.2012

I scripted so you start with 500, but when i join i got 2 000 and after i buy something for ec 10, i get 490 but every time i log in i start with 2000 why?


Re: Money problem? - Akcent_Voltaj - 15.08.2012

got
Quote:

new dollah = 2000;

this is how it is to mee..


Re: Money problem? - doreto - 15.08.2012

Are you sure you dont have SetPlayerMoney(...,2000) after player connect/spawn ?


Re: Money problem? - N0FeaR - 15.08.2012

This is what i using

pawn Код:
stock GivePlayerCash(playerid, money)
{
    PlayerInfo[playerid][pCash] += money;
    ResetMoneyBar(playerid);
    UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);
    return PlayerInfo[playerid][pCash];
}

stock SetPlayerCash(playerid, money)
{
    PlayerInfo[playerid][pCash] = money;
    ResetMoneyBar(playerid);
    UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);
    return PlayerInfo[playerid][pCash];
}

stock ResetPlayerCash(playerid)
{
    PlayerInfo[playerid][pCash] = 0;
    ResetMoneyBar(playerid);
    UpdateMoneyBar(playerid,PlayerInfo[playerid][pCash]);
    return PlayerInfo[playerid][pCash];
}

stock GetPlayerCash(playerid)
{
    return PlayerInfo[playerid][pCash];
}

here is the saving

pawn Код:
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
        format( String, sizeof( String ), "UPDATE `Accounts`, `Money` = '%d', `Skin` = '%d', `SpawnPoint` = '%d', `HouseKey` = '%d', `BizKey` = '%d' WHERE `UserID` = '%d'"
        ,PlayerInfo[playerid][pCash],PlayerInfo[playerid][pSkin],PlayerInfo[playerid][pSpawnPoint],PlayerInfo[playerid][pHouseKey],PlayerInfo[playerid][pBizKey],PlayerInfo[playerid][pDatabaseID]);
        mysql_query(String);



Re: Money problem? - N0FeaR - 15.08.2012

And the money wont save when i logoff from the server. thats the problem


Re: Money problem? - N0FeaR - 15.08.2012

See here in /stats says cash:500 is right nut the green one is says 1000 :O?




Re: Money problem? - Akcent_Voltaj - 15.08.2012

we have samp gamemode is your money GivePlayerCash or GivePlayerMoney??


Re: Money problem? - new121 - 15.08.2012

Use ResetPlayerCash in OnPlayerDisconnect and be sure that is called AFTER it saves your money. Or you can call ResetPlayerCash in OnPlayerConnect, sometime BEFORE it gives you your saved money.