Command Help
#1

Can I make it so if a cop is within 150 meters, you cannot ececute a command?
Like
[Command]
[If cop is within 150 meters return 0]
[What the command does]
Reply
#2

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerStreamedIn(i, playerid) && IsCop(i) /* replace with your cop variable */)
    {
        // Do stuff
        break;
    }
}
Reply
#3

pawn Код:
if(!strcmp(cmdtext,"/edm",true))

        if(IsPlayerStreamedIn(i, playerid) && IsCop(i) /* replace with your cop variable */)
    {
            ResetPlayerWeapons(playerid);
            SetPlayerPos(playerid,28.1063, 2242.8928, 126.0000);
            SetPlayerInterior(playerid,0);
            GivePlayerWeapon(playerid,30,999999);
            GameTextForPlayer(playerid,"Welcome to ~g~EEFS~N~ ~R~DeathMatch!",2500,3);
            SetPlayerHealth (playerid, 100);
            return 1;
            }
pawn Код:
C:\Users\Johnathon\Desktop\GTA\emaps.pwn(207) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

Quote:
Originally Posted by [MM]18240[FMB]
Посмотреть сообщение
pawn Код:
if(!strcmp(cmdtext,"/edm",true))

        if(IsPlayerStreamedIn(i, playerid) && IsCop(i) /* replace with your cop variable */)
    {
            ResetPlayerWeapons(playerid);
            SetPlayerPos(playerid,28.1063, 2242.8928, 126.0000);
            SetPlayerInterior(playerid,0);
            GivePlayerWeapon(playerid,30,999999);
            GameTextForPlayer(playerid,"Welcome to ~g~EEFS~N~ ~R~DeathMatch!",2500,3);
            SetPlayerHealth (playerid, 100);
            return 1;
            }
pawn Код:
C:\Users\Johnathon\Desktop\GTA\emaps.pwn(207) : error 017: undefined symbol "i"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
You'll have to use the whole loop (script) that Vince posted, like this:

pawn Код:
if(!strcmp(cmdtext,"/edm",true){
      for(new i = 0; i <MAX_PLAYERS; i++){
    if(IsPlayerStreamedIn(i, playerid) && IsCop(i) /* replace with your cop variable */){
            ResetPlayerWeapons(playerid);
            SetPlayerPos(playerid,28.1063, 2242.8928, 126.0000);
            SetPlayerInterior(playerid,0);
            GivePlayerWeapon(playerid,30,999999);
            GameTextForPlayer(playerid,"Welcome to ~g~EEFS~N~ ~R~DeathMatch!",2500,3);
            SetPlayerHealth (playerid, 100);
            return 1;
            }
            else{
            //send a error message?
            return 1;
            }
      }
}
Hope it helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)