SA-MP Forums Archive
[Tutorial] [TUT] Anti-weapon hack - Longer/more useful - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] [TUT] Anti-weapon hack - Longer/more useful (/showthread.php?tid=148849)



[TUT] Anti-weapon hack - Longer/more useful - coole210 - 19.05.2010

hah, bad enough.


Re: [TUT] Anti-weapon hack - Longer/more useful - Sergei - 19.05.2010

Point of this topic is? It's just one function which spams some speicif people with messages from all palyers every 5 seconds and resets player weapons everytime.


Re: [TUT] Anti-weapon hack - Longer/more useful - Joe_ - 19.05.2010

Code:
#define white 0xFFFFFFFF

new BadCheckTimer;

new BadWeapons[3] =
{
	38, 36, 39
};

forward MessageToAdmins(color,const string[]);
Code:
BadCheckTimer = SetTimer("BadCheck",5000,1);
Code:
KillTimer(BadCheckTimer);
Code:
forward BadCheck();
public BadCheck()
{
  new weap, string[128], pname[MAX_PLAYER_NAME]; // Shortened by 128 Cells, 256 Cells are crap kthx.
	for(new i, b = GetMaxPlayers(); i < b; i++) // Loop around MaxPlayers Server.cfg varible & removed IsPlayerConnected
	{
	  GetPlayerName(i, pname, sizeof(pname));
	  
	  weap = GetPlayerWeapon(i);
	  for(new w; w < sizeof(BadWeapons); w++)
	  {
			if(weap == BadWeapons[w])
			{
				format(string,sizeof(string),"[ ! ]%s Has got a %s.", pname, weap);
				MessageToAdmins(white,string);
				ResetPlayerWeapons(i);
			}
			return 1;
		}
	}
	return 1;
}

public MessageToAdmins(color,const string[])
{
	for(new a,b=GetMaxPlayers();a<b;a++)
	{
		if(IsPlayerAdmin(a)) SendClientMessage(a, color, string);
	}
	return 1;
}
Made quickly so you can see how much of your code is undeeded (This probably has some missing code, but It -shows- what can be shortened)

Don't even bother wasting your time to say it won't work, read above



Re: [TUT] Anti-weapon hack - Longer/more useful - coole210 - 19.05.2010

....


Re: [TUT] Anti-weapon hack - Longer/more useful - Joe_ - 19.05.2010

You can't own a gun with no ammo, GTA automaticly removes it, so it's moot point

So if you have a gun, you obviously have ammo.


Re: [TUT] Anti-weapon hack - Longer/more useful - Sergei - 19.05.2010

You can have weapon with no ammo (0), but you cannot put it in active weapon slot.


Re: [TUT] Anti-weapon hack - Longer/more useful - coole210 - 19.05.2010

....