how to allow RPG
#1

hi there how to allow Rpg and other gun like minigun for admins and disallow for normal players ?
Reply
#2

You cut use a timer to check if they have the gun?


On Top
Код:
forward Mhack(playerid);
OnGameModeInnit
Код:
SetTimer("Mhack",3000,1);
Bottom of script
Код:
public Mhack(playerid)
{
if(GetPlayerWeapon(playerid) == 38)
{
if(IsPlayerAdmin(playerid))
{
return 1;
}
Kick(playerid);
SendClientMessage(playerid,COLOUR_RED,"Minigun is not allowed");
return 1;
}
This would kick the player if the player has a minigun.
Reply
#3

Quote:
Originally Posted by Naxix
You cut use a timer to check if they have the gun?


On Top
Код:
forward Mhack(playerid);
OnGameModeInnit
Код:
SetTimer("Mhack",3000,1);
Bottom of script
Код:
public Mhack(playerid)
{
if(GetPlayerWeapon(playerid) == 38)
{
if(IsPlayerAdmin(playerid))
{
return 1;
}
Kick(playerid);
SendClientMessage(playerid,COLOUR_RED,"Minigun is not allowed");
return 1;
}
This would kick the player if the player has a minigun.
That won't work.

Do this
pawn Код:
//TOP
forward AntiHack();

//OnGamemodeInit
SetTimer("AntiHack",3000,1);

//Where ever
public AntiHack()
{
  for(new i; i<MAX_PLAYERS; i++)
  {
     if(IsPlayerAdmin(i) || !IsPlayerConnected(i)) continue;
     if(GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 35)
     {
       SendClientMessage(playerid,COLOUR_RED,"Minigun/Rocket Lauchers are not allowed!");
       Kick(i);
     }
  }
  return 1;
}
Reply
#4

I always do that like this;

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  	new minigun;
  minigun = GetPlayerWeapon(playerid);
	if ((newkeys & 4) && (newkeys & 128))
	{
  if(minigun == 38)
  {
  GameTextForPlayer(playerid,"~r~MINIGUN IS NOT ALLOWED",3000,5);
  ResetPlayerWeapons(playerid);
	}
	}
	return 1;
}
Reply
#5

[HiC]TheKiller

thanks man its worked
Reply
#6

but id i put this SendClientMessage(playerid,COLOUR_RED,"Minigun/Rocket Lauchers are not allowed!");


kick aint work and when i remove the message kick will work how to fix it ?
Reply
#7

Change this
pawn Код:
SendClientMessage(playerid,COLOUR_RED,"Minigun/Rocket Lauchers are not allowed!");
To this:
pawn Код:
SendClientMessage(i,0xFF0000AA,"Minigun/Rocket Lauchers are not allowed!");
Reply


Forum Jump:


Users browsing this thread: