SA-MP Forums Archive
how to allow RPG - 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: how to allow RPG (/showthread.php?tid=140729)



how to allow RPG - omid - 10.04.2010

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



Re: how to allow RPG - Naxix - 10.04.2010

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.


Re: how to allow RPG - [HiC]TheKiller - 10.04.2010

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;
}



Re: how to allow RPG - boelie - 10.04.2010

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;
}



Re: how to allow RPG - omid - 23.04.2010

[HiC]TheKiller

thanks man its worked


Re: how to allow RPG - omid - 23.04.2010

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 ?


Re: how to allow RPG - CAR - 23.04.2010

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!");