Command Help - 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)
+--- Thread: Command Help (
/showthread.php?tid=367719)
Command Help -
[MM]18240[FMB] - 10.08.2012
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]
Re: Command Help -
Vince - 10.08.2012
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerStreamedIn(i, playerid) && IsCop(i) /* replace with your cop variable */)
{
// Do stuff
break;
}
}
Re: Command Help -
[MM]18240[FMB] - 10.08.2012
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.
Re: Command Help -
Ranama - 10.08.2012
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