SA-MP Forums Archive
Server-Side 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: Server-Side money (/showthread.php?tid=548511)



Server-Side money - CalvinC - 30.11.2014

I have some server-side money, which works perfectly with the mechanics of the server:
pawn Код:
stock GiveZaiatMoney(playerid, amount)
{
    new string[128];
    if(amount < 0) format(string, sizeof(string), "~r~-$%d", amount*-1);
    else if(amount > 0) format(string, sizeof(string), "~g~+$%d", amount);
    GameTextForPlayer(playerid, string, 3000, 1);
    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
    PlayerInfo[playerid][pMoney] = PlayerInfo[playerid][pMoney]+amount;
    GivePlayerMoney(playerid,amount);
    return 1;
}

stock SetZaiatMoney(playerid, amount)
{
    PlayerInfo[playerid][pMoney] = amount;
    SetPlayerMoney(playerid,amount);
    return 1;
}
I use GivePlayerMoney and SetPlayerMoney for it to work clientside aswell, but i need to know how to do this at OnPlayerSpawn? So that the money becomes visible when he spawns?


Re: Server-Side money - Larceny - 30.11.2014

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetZaiatMoney(playerid, PlayerInfo[playerid][pMoney]);
}
Assuming you are using a custom function to SetPlayerMoney as it is not a native function.


Re: Server-Side money - CalvinC - 30.11.2014

I am using SetPlayerMoney as i said, but thanks, that worked.