SA-MP Forums Archive
Idea: Server Sided Guns! - 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: Idea: Server Sided Guns! (/showthread.php?tid=133822)



Idea: Server Sided Guns! - Arsham7 - 14.03.2010

Hey okay there is server sided money for an anti cheat already, but i was wondering is it possible for one of you head crazy scripters to script a server sided guns anti hack? so haxed weps would be taken away and non haxed wouldnt


Re: Idea: Server Sided Guns! - WThieves - 14.03.2010

Think that's gonna be really hard, but good idea though :P, also the serverside money is a bit buggy 'cause it detects stunting money as a hack and also soda buying, buying food, buying at the ammunation and all that sort of things.


Re: Idea: Server Sided Guns! - Nero_3D - 14.03.2010

its the same with all server sided things, create an array which stores the data
And the same is with the problems, only server sided things gets dedected
so if you buy a weapon at the ammunation it would be a hack
so this code needs an check for the players position
and then hacking would be still possible there


Re: Idea: Server Sided Guns! - cessil - 14.03.2010

I took out the ammunation in my server and created an anti spawn weapon script, it stores the weapon id into its slot and checks if the players weapons differ from what the server has, it's really effective since cheaters learn there's some weapons that are forbidden so they cheat weapons that aren't forbidden.

at the top
Code:
new sw[MAX_PLAYERS];
in "OnFilterScriptInit()"
Code:
SetTimer("WeaponCheck",5000,1);
in the onplayerconnect, disconnect, death and spawn.
Code:
sw[playerid] = 0;
Then I have this.
Code:
forward WeaponCheck();
public WeaponCheck()
{
	new string[128];
	new name[30];
  new Float:health[MAX_PLAYERS];
	for(new j;j<MAX_PLAYERS;j++)
	{
	  GetPlayerHealth(j,health[j]);
		if(IsPlayerConnected(j) && health[j] >= 10 && GetPlayerState(j) == PLAYER_STATE_ONFOOT)
	  {
			if (CallRemoteFunction("OnPlayerWeaponCheck","d",j))
			{
				sw[j]++;
				if(sw[j] >= 3)
				{
			  	GetPlayerName(j,name,sizeof(name));
	      		CallRemoteFunction("BanIncrease","d",j);
				  	format(string, sizeof(string), "AC BAN: %s has been banned", name);
					SendClientMessageToAll(colour_red, string);
	      		new Float:X,Float:Y,Float:Z;
	      		GetPlayerPos(j,X,Y,Z);
				  	format(string, sizeof(string), "AC Ban: spawned weapons position(%f,%f,%f)",X,Y,Z);
					sw[j] = 0;
					BanEx(j,string);
				}
			}
			else if(!CallRemoteFunction("OnPlayerWeaponCheck","d",j)) sw[j] = 0;
		}
	}
}
all the above is in a filterscript.

in the Game Mode I have this at the top
Code:
new WeaponCheck[MAX_PLAYERS][12];
every time a player gets a weapon
Code:
WeaponCheck[playerid][2] = 23;
23 is the weaponid and 2 is the slot

then this function for the filterscript to call
Code:
forward OnPlayerWeaponCheck(playerid);
public OnPlayerWeaponCheck(playerid)
{
	for(new i = 0; i < 12; i++)
	{
	  new tweap, tammo;
	  GetPlayerWeaponData(playerid, i ,tweap ,tammo);
	  if(tweap != WeaponCheck[playerid][i]) return tweap;
	}
	return 0;
}