08.10.2013, 19:45
Hello
i have a problem that i made a arrest command so i added a code that will realese me from jail like if i jail someone
he has a timer but i have waited the time i have seted it in the gamemode but it dosent realse me
and if someone can also make me like a gametext timer for jail it will be awesome
here is my code:
i have a problem that i made a arrest command so i added a code that will realese me from jail like if i jail someone
he has a timer but i have waited the time i have seted it in the gamemode but it dosent realse me
and if someone can also make me like a gametext timer for jail it will be awesome
here is my code:
pawn Код:
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;
}