Money problem?
#1

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?
Reply
#2

got
Quote:

new dollah = 2000;

this is how it is to mee..
Reply
#3

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

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);
Reply
#5

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

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

Reply
#7

we have samp gamemode is your money GivePlayerCash or GivePlayerMoney??
Reply
#8

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)