Server-Side money
#1

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)