[Tutorial] [TUT] Anti-weapon hack - Longer/more useful
#1

hah, bad enough.
Reply
#2

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

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

....
Reply
#5

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

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

....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)