Making a weapon ban script. FS?
#1

Okay, hello everyone, I was experimenting with a script that I made though I am a new coder, and havent done anything yet, this is what I came up with.

Код:
#include <a_samp>
>>public missing - what should I forward?<<
	new weap, ammo;
	for(new i - 0; i < MAX_PLAYERS; i++)
	{
	  if(IsPlayerConnected(i))
		{
			GetPlayerWeaponData(i, 7, weap, ammo);
  			if(ammo > 1 && weap == 9
      SendPlayerMessageToPlayer(playerid, senderid, "You have been banned for using a weapon hack.");
			Ban([i]);
		return 1;
		}
		else if(ammo > 1 && weap == 35 || 36 || 37 || 38 || 39 || 40 || 43 || 44 || 45
		SendPlayerMessageToPlayer(playerid, senderid, "You have been banned for using a weapon hack.");
		Ban([i]);
What im trying to do here is make a system where it bans these weapons if a player gets a hold of them, and also I cant seem to get a public assigned, or make the [i] work, can I get some help here?

Also, if my code is wrong, please show me how to correct this!

p.s. this is what I get when i try to compile with the pawno compiler.

Код:
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32\filterscripts\bantest.pwn(4) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32\filterscripts\bantest.pwn(6) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32\filterscripts\bantest.pwn(9) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32\filterscripts\bantest.pwn(12) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32\filterscripts\bantest.pwn(14) : error 010: invalid function or declaration
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32\filterscripts\bantest.pwn(18) : warning 203: symbol is never used: "ammo"
C:\Documents and Settings\Administrator\Desktop\samp02Xserver.win32\filterscripts\bantest.pwn(18) : warning 203: symbol is never used: "weap"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply
#2

Код:
forward weaponhack();
public weaponhack()
{
	new weap, ammo;
	for(new i=0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			GetPlayerWeaponData(i, 7, weap, ammo);
			if(ammo > 1 && weap == 9)
			{
		    SendClientMessage(i, 0xFFFFFFAA, "You have been banned for using a weapon hack.");
				Ban(i);
			}
			else if(ammo > 1 && weap == 35 || weap == 36 || weap == 37 || weap == 38 || weap == 39 || weap == 40 || weap == 43 || weap == 44 || weap == 45)
			{
				SendClientMessage(i, 0xFFFFFFAA, "You have been banned for using a weapon hack.");
				Ban(i);
			}
		}
	}
	return 1;
}
Reply
#3

Quote:
Originally Posted by gkstjd031
Код:
forward weaponhack();
public weaponhack()
{
	new weap, ammo;
	for(new i=0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			GetPlayerWeaponData(i, 7, weap, ammo);
			if(ammo > 1 && weap == 9)
			{
		    SendClientMessage(i, 0xFFFFFFAA, "You have been banned for using a weapon hack.");
				Ban(i);
			}
			else if(ammo > 1 && weap == 35 || weap == 36 || weap == 37 || weap == 38 || weap == 39 || weap == 40 || weap == 43 || weap == 44 || weap == 45)
			{
				SendClientMessage(i, 0xFFFFFFAA, "You have been banned for using a weapon hack.");
				Ban(i);
			}
		}
	}
	return 1;
}
I tried to use this and implement it into my gm, but for some reason, it doesnt work when the player gets a weapon.

What I want it to do is this, as soon as the player gets the weapon, I want it to pick up the weapon (detect it) then send the message to ban the player.
Reply
#4

Try ammo > 0 lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)