Variables
#1

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

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

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

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

Thanks man!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)