View Full Version : server sided money question

03/06/2016, 11:33 AM
okay, so on my server, when someone dies and loses $100, for some reason the anticheat has a spasm.

if(GetPlayerCash(playerid) < GetPlayerMoney(playerid))
-anticheat code here-

i was wondering how to make it only detect when say, GetPlayerMoney is more than 101 for example.

if(GetPlayerCash(playerid) < 100 of GetPlayerMoney(playerid))

but adding it like that in the script doesn't work. how do i go about making that check in 1 singular line? by that check i mean the <100

03/06/2016, 11:34 AM
Hmm give me the command / a function where you add money

03/06/2016, 11:38 AM
Something like this.

if(GetPlayerCash(playerid) < (GetPlayerMoney(playerid) == 100))

03/06/2016, 11:40 AM
if(strcmp(cmd, "/money", true) == 0)
if(pInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, WHITE, "SERVER: Unknown command.");
if(pInfo[playerid][pLogin] == 0) return SendClientMessage(playerid, RED, "Register or Login first before using this command!");
new stringadm[64];
if (pInfo[playerid][pAdmin] >= 4){
GivePlayerCash(playerid, 1000000);
format(stringadm,sizeof(stringadm),"[ADM]: %s used /money",GetName(playerid));
return 1;

03/06/2016, 11:41 AM
Something like this.

if(GetPlayerCash(playerid) < (GetPlayerMoney(playerid) == 100))

That makes zero sense whatsoever.

You don't want to make exceptions. For every instance that the player gets or loses money in your server, also apply this to the variable. If this is done correctly, your anti cheat will function as expected.

03/06/2016, 11:43 AM
You wanna make a variable with enums to check if that variable matches the player money.
If it doesn't matches, you can make a message to admins saying "Player's money doesn't matches", or automatically ban him.

03/06/2016, 11:49 AM
i've noticed a bug where if the player dies from an explosion but is still on fire afterwards, they run around for a bit and the client hasn't removed the $100 yet but the server has already acknowledged that they died and removed $100, the check for money hacks runs once every 5 seconds if the players server sided cash is less than the players client sided cash. I want to add an exception of $100 to negate this. I doubt anyone will sit their giving themselves $100 each time they die to bypass the anticheat

03/06/2016, 12:35 PM
fixed it myself with a bit more extensive trial and error. thanks for the help guys

03/06/2016, 12:59 PM
Btw try with adding temp 100$ on player's money And then check

03/06/2016, 01:05 PM
fixed it myself with a bit more extensive trial and error. thanks for the help guys

I know you already fixed it but I'll just explain why that's happening.

Server sided money is just a number in a variable.
When the server automatically removed $100 on the player's death/spawn, it's not updating that variable.
So you can either decrease the player's variable by 100 when the player dies, or you can remove the -$100 feature by resetting the player's money and giving them the number in their variable.