open.mp forum
[Pawn] add, subtract - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] add, subtract (/showthread.php?tid=2249)



add, subtract - ZyZu. - 2021-11-13

I haven't did any coding over 4-5 years now. Anyways I decided to start working on my gamemode again. I used to have an include to add, subtract, divide, multiply stocks. Does anyone has this include? I have to find all the plugins and includes but since the main forum is down everything is hard to find. Thanks.



Code:
subtract(cash, amount[1])



Code:
stock GivePlayerCash(playerid, amount[]) {

    static cash[256];

    GetPVarString(playerid, "pMoney", cash, 256);

    if(strfind(amount, "-") == 0) SetPVarString(playerid, "pMoney", subtract(cash, amount[1]));

    else SetPVarString(playerid, "pMoney", add(cash, amount));

    return 1;

}



RE: add, subtract - Radical - 2021-11-15

What is the name of that include? Did you google it?

Anyway if?you do not find that include, create that function yourself using?strval.


RE: add, subtract - Y_Less - 2021-11-17

This is just ``, `-`, etc. You don't need an include for maths.