very very simple server sided weapons in progress
#1

So we set a variable PlayerInfo[i][pHasGun] and whenever the player buys a gun this variable turns into 1.

GetPlayerWeaponData(i, w, weapon, ammo);

if(weapon >= 1 && weapon <= 46 && PlayerInfo[i][pHasGun] == 0)//gun check if the player has a gun which id is higher than 0 and lower or equal to 46 which was not bought ingame then it would reset player weapons, else it won't
{
ResetPlayerWeapons(i);
{
format(string, sizeof(string), "AdmCmd: %s Tried to hack and his/her guns have got resetted", PlayerName(i));
SendClientMessageToAll(COLOR_LIGHTRED, string);
}
}
I tested this and it worked, but hackers may still find their way through.
Known Issues: The player may buy a mp5 and then he will start hacking weapons all around

We can also set a method so the player gets a gun with a quantity of ammo of 8000 for example and if the ammo is lower than 5000 we can strip the weapons away.
Reply
#2

You code is kinda hard to understand xD
Well heres a simple code (my version)

Code:
#define BannableGuns 38||GetPlayerWeapon(playerid) ==37||GetPlayerWeapon(playerid) ==36||GetPlayerWeapon(playerid) ==35||GetPlayerWeapon(playerid) ==39||GetPlayerWeapon(playerid) ==40

public OnPlayerUpdate(playerid)
 {
    if(GetPlayerWeapon(playerid) == BannableGuns)
     {
     SendClientMessage(playerid, Red, "Anti-cheat System : detects you spawning an innapropriate gun!");
	 ResetPlayerWeapons(playerid);
     }
     return 1;
}
Reply
#3

Nice 1
Reply
#4

The best way for an anti cheat system in my experience is to compare client side with server side. This means limiting the player to a certain amount of weapons, and when he buys/sells/trades weapons, his/her user file is saved with the weapons he has. Then create a timer which will compare the players weapon to the information in his/her user file, if they do not match then reset weapons, if they do match then take no action.
Reply
#5

GetPlayerGun = Get the gun he is currently holding = ongoing timer = LAG.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)