CMD:arrest(playerid, params[])
{
if(PlayerInfo[playerid][PoliceMan] == >1)
{
new pID;
if(sscanf(params, "u", pID))return SendClientMessage(playerid, -1, "Syntax:/arrest [playerid]");
if(pID == INVALID_PLAYER_ID)return SendClientMessage(playerid, -1, "Player Not Found.");
if(GetPlayerWantedLevel(pID) >= 1)return SendClientMessage(playerid, -1, "Play has not an Wanted Level");
SetPlayerPos(pID, x, y, z); //The Cordinates x, y, z replace with your jail pos.
SetPlayerWantedLevel(pID, 0);
GameTextForPlayer(pID, "You are jailed for 10 seconds.", 3000, 3); //Replace 10 seconds with you time.
SetTimerEx("Jail", 10000, "i", pID); //Seting an Timer for Jail 10sec.= 10000milisec.
return 1;
}
forward Jail(pID);
public Jail(pID)
{
GameTextForPlayer(pID, "You are not jailed any more", 3000, 3);
SetPlayerPos(pID, 0, 0, 0);
return 1;
}
if(sscanf(params, "u", pid))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 3.0, x, y, z)) //3.0 is the range, change this to whatever you want.
{
SetPlayerPos(i, 0.0, 0.0, 0.0);
break; //or just return 1, it will stop the loop (I think return 1 will do it as well);
}
}
return 1;
}
else
{
//Code for SetPlayerPos(pid...)
return 1;
}
Instead of the sscanf above use something like this (not tested either, made up just now so it might be wrong):
pawn Код:
|
for(new a = 0; a <= 10000; a++)
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
new Float:range; //make new float
range = float(a); //convert the integer first for loop variable a into range
if(IsPlayerInRangeOfPoint(i, range, x, y, z))
{
SetPlayerPos(i, 0.0, 0.0, 0.0);
break;
}
}
}
if(sscanf(params, "u", pid))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new vw = GetPlayerVirtualWorld(playerid);
for(new i = 0; i <= MAX_PLAYERS; i++)
{
vwI = GetPlayerVirtualWorld(i);
if((IsPlayerInRangeOfPoint(i, 3.0, x, y, z)) && (vwI == vw)) //3.0 is the range, change this to whatever you want.
{
SetPlayerPos(i, 0.0, 0.0, 0.0);
break; //or just return 1, it will stop the loop (I think return 1 will do it as well);
}
}
return 1;
}
else
{
//Code for SetPlayerPos(pid...)
return 1;
}
if(sscanf(params, "u", pID))return SendClientMessage(playerid, -1, "Usage: /arrest [playerid]");
if(sscanf(params, "u", pID)) return "The Loops");