server sided money question
#1

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

Hmm give me the command / a function where you add money
Reply
#3

Something like this.

PHP код:
if(GetPlayerCash(playerid) < (GetPlayerMoney(playerid) == 100)) 
Reply
#4

PHP код:
if(strcmp(cmd"/money"true) == 0)
{
if(
pInfo[playerid][pAdmin] == 0) return SendClientMessage(playeridWHITE"SERVER: Unknown command.");
if(
pInfo[playerid][pLogin] == 0) return SendClientMessage(playeridRED"Register or Login first before using this command!");
new 
stringadm[64];
if (
pInfo[playerid][pAdmin] >= 4){
GivePlayerCash(playerid1000000);
format(stringadm,sizeof(stringadm),"[ADM]: %s used /money",GetName(playerid));
SendToAdmin(COLOR_ADM,stringadm);
}
return 
1;

Reply
#5

Quote:
Originally Posted by oMa37
Посмотреть сообщение
Something like this.

PHP код:
if(GetPlayerCash(playerid) < (GetPlayerMoney(playerid) == 100)) 
That makes zero sense whatsoever.

@OP:
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.
Reply
#6

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

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
Reply
#8

fixed it myself with a bit more extensive trial and error. thanks for the help guys
Reply
#9

Btw try with adding temp 100$ on player's money And then check
Reply
#10

Quote:
Originally Posted by tommzy09
Посмотреть сообщение
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)