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



Variables - sherlock - 02.10.2011

CallRemoteFunction("GivePlayerMoney", "dd", playerid, -80);

Thats what im adding to filtersctripts for the players money because of my anticheat. But instead of taking 80 dollars from the player,this sets their money to -80. How can i make it so that it takes $80?

I think i need to make the amount a variable,but i had a look at the wiki page on variables and didnt understand it.


Re: Variables - Jefff - 02.10.2011

You must create a public function not samp function GivePlayerMoney
pawn Код:
formard GivePlayerMoneyEx(playerid,Amount);
public GivePlayerMoneyEx(playerid,Amount)
{
GivePlayerMoney(playerid,Amount);
return 1;
}



Re: Variables - sherlock - 02.10.2011

I cant use giveplayermoneyex on its own like that,my anticheat wont enable me to. I already have a public function and a forward for it. But like i say the code is setting the money to that and not simply taking it from the players current money.

I already have this under forwards:
forward vx_GivePlayerMoney(playerid, money);

This under publics:
public vx_GivePlayerMoney(playerid, money)
{
Player[playerid][Money] = money;
return 1;
}

And in the filterscript i change the standard giveplayermoney to:
CallRemoteFunction("vx_GivePlayerMoney", "dd", playerid, -80);

But instead of taking $80 it is actually setting the players money to $80.


Re: Variables - AeroBlast - 02.10.2011

pawn Код:
public vx_GivePlayerMoney(playerid, money)
{
    Player[playerid][Money] = Player[playerid][Money]+money;
    return 1;
}
Try this.


Re: Variables - sherlock - 02.10.2011

Thanks man!!