SA-MP Forums Archive
very very simple server sided weapons in progress - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: very very simple server sided weapons in progress (/showthread.php?tid=152360)



very very simple server sided weapons in progress - Guest47539487598357938457534dfssfd - 03.06.2010

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.


Re: very very simple server sided weapons in progress - ViruZZzZ_ChiLLL - 03.06.2010

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;
}



Re: very very simple server sided weapons in progress - Jonni8 - 03.06.2010

Nice 1


Re: very very simple server sided weapons in progress - Conroy - 03.06.2010

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.


Re: very very simple server sided weapons in progress - coole210 - 03.06.2010

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