CMD:ar(playerid,params[])
{
new targetid;
new string[128];
if(sscanf(params, "u", targetid))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /ar (Player Name/ID)");
return 1;
}
if(gTeam[playerid] != Team_Cop)
{
SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can arrest wanted suspects.");
return 1;
}
if(!IsPlayerConnected(targetid))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot arrest them.",targetid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,targetid) > 4)
{
format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to arrest him.",GetName(targetid),targetid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPVarInt(targetid, "Cuffed") == 0)
{
format(string,sizeof(string),"%s(%d) is not cuffed. You have to place the suspect in cuffs before attempted to arrest them.",GetName(targetid),targetid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect while in a vehicle. Exit the vehicle first.");
return 1;
}
if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER || GetPlayerState(targetid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect they are in a vehicle. Get them to exit the vehicle first.");
return 1;
}
if(playerid == targetid)
{
SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself, why would you do that anyway?");
return 1;
}
if(GetPlayerWantedLevel(targetid) < 3)
{
format(string,sizeof(string),"%s(%d)'s wanted level is too low. You cannot jail them. Use /ticket (Player ID).",GetName(targetid),targetid);
SendClientMessage(playerid,COLOR_ERROR,string);
return 1;
}
new pwl = GetPlayerWantedLevel(targetid);
if(pwl == 4)
{
GivePlayerMoney(playerid, 3000);
IncreaseScore(playerid, 1);
IncreaseCoprank(playerid, 1);
SetPVarInt(targetid, "JailTime", 45);
SetPlayerInterior(targetid, 10);
new rnd = random(sizeof(PrisonSpawn));
SetPlayerPos(targetid, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
SendClientMessage(playerid, COLOR_GREY, "**LOS SANTOS PRISON**");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
TogglePlayerControllable(targetid, 1);
SetPlayerWantedLevel(targetid, 0);
return 1;
}
return 1;
}
for(new i = 0; i <= MAX_PLAYERS; i++) { if(JailTime[i] > 1) { //Timer format(string,sizeof(string),"Total Jailtime: %d",JailTime[i]); GameTextForPlayer(playerid,JailTime[i],5); JailTime[i] --; } if(JailTime[i] == 1) { format(string,sizeof(string),"[JAIL] {FFFFFF}%s(%d) has been released from jail. {00FF00}[Served his time]",pname,i); SendClientMessageToAll(COLOR_YELLOW,string); TotalJailTime[i] =0; JailTime[i] =0; SetPlayerPos(i,225.8451,112.8976,1003.2188); SetPlayerFacingAngle(i,1.0816); SetCameraBehindPlayer(i); SetPlayerHealth(i,100); SetPlayerInterior(i,10); } }
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1260) : error 017: undefined symbol "JailTime" C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1260) : warning 215: expression has no effect C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1260) : error 001: expected token: ";", but found "]" C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1260) : error 029: invalid expression, assumed zero C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1260) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
SetTimerEx("Release", 1000, false, "i", targetid); // Jail the target for 45 seconds
// Somewhere else
forward Release(playerid);
public Release(playerid)
{
if(GetPVarInt(playerid, "JailTime") <= 0)
{
// He's released from jail, do something
return 1;
}
else
{
new str[50];
format(str, sizeof(str), "You will be released in: %d", GetPVarInt(playerid, "JailTime"));
SendClientMessage(playerid, -1, str); // Change it if you want
}
SetPVarInt(playerid, "JailTime", GetPVarInt(playerid, "JailTime") - 1); // Decrease the player's jail time
SetTimerEx("Release", 1000, false, "i", playerid);
return 0;
}
In the command put:
pawn Код:
|