COMMAND:arrest(playerid, params[]) { if(PlayerInfo[playerid][pCop] == 1) { new targetid; if(!sscanf(params, "u", targetid)) { if(PlayerInfo[targetid][pWanted] >= 1) { new Float:targetX, Float:targetY, Float:targetZ; GetPlayerPos(targetid, targetX, targetY, targetZ); if(IsPlayerInRangeOfPoint(playerid, 5, targetX, targetY, targetZ)) { if(PlayerInfo[targetid][pCuffed] == 1) { if(IsPlayerInRangeOfPoint(playerid, 5, //the pos for the LSPD garage or whatever...)) { SetPlayerPos(targetid, //pos for the jail); //OPTIONAL: SetPlayerColor(targetid, colorForJailedPeople); PlayerInfo[targetid][pJailed] = 1; } } } } } } return 1; }
CMD:arrest(playerid, params[]) { if(PlayerInfo[playerid][Fmember] == 1) { new toplayer; new jailtime; new price; if(!sscanf(params, "uii", toplayer, jailtime, price)) { if((jailtime >= 1 && jailtime <= 10)) { if(IsPlayerInRangeOfPoint(toplayer, 20.0, 221.9771, 121.3747, 999.0156)) { if(IsPlayerInRangeOfPoint(playerid, 20.0, 221.9771, 121.3747, 999.0156)) { new string[128]; new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(toplayer, PlayerName, sizeof(PlayerName)); format(string, sizeof(string), "You are jailed for %d days by %s!", jailtime * 60000, name); SCM(toplayer, COLOR_BLUE, string); SetPlayerPos(toplayer, 219.3402, 110.0057, 999.0156); SetPlayerInterior(toplayer, 10); ResetPlayerWeapons(toplayer); jailed[toplayer] = 1; SetTimerEx("unjail", jailtime * 60000, false, "i", toplayer); GivePlayerCash(toplayer, -price); PlayerInfo[toplayer][Suspect] = sus_no; SetPlayerColor(toplayer, COLOR_WHITE); } else return SendClientMessage(playerid, 0x2641FEAA, "You are not near the jail!"); } else return SendClientMessage(playerid, 0x2641FEAA, "No suspect near the jail!"); } else return SendClientMessage(playerid, 0x2641FEAA, "Jailtime cant be shorter then 1 or longer then 10"); } else return SendClientMessage(playerid, 0x2641FEAA, "USAGE: /arrest [Playername] [JailTime] [price]"); } else return SendClientMessage(playerid, 0x2641FEAA, "You are not a cop!"); return 1; }
My command:
Код:
CMD:arrest(playerid, params[]) { if(PlayerInfo[playerid][Fmember] == 1) { new toplayer; new jailtime; new price; if(!sscanf(params, "uii", toplayer, jailtime, price)) { if((jailtime >= 1 && jailtime <= 10)) { if(IsPlayerInRangeOfPoint(toplayer, 20.0, 221.9771, 121.3747, 999.0156)) { if(IsPlayerInRangeOfPoint(playerid, 20.0, 221.9771, 121.3747, 999.0156)) { new string[128]; new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(toplayer, PlayerName, sizeof(PlayerName)); format(string, sizeof(string), "You are jailed for %d days by %s!", jailtime * 60000, name); SCM(toplayer, COLOR_BLUE, string); SetPlayerPos(toplayer, 219.3402, 110.0057, 999.0156); SetPlayerInterior(toplayer, 10); ResetPlayerWeapons(toplayer); jailed[toplayer] = 1; SetTimerEx("unjail", jailtime * 60000, false, "i", toplayer); GivePlayerCash(toplayer, -price); PlayerInfo[toplayer][Suspect] = sus_no; SetPlayerColor(toplayer, COLOR_WHITE); } else return SendClientMessage(playerid, 0x2641FEAA, "You are not near the jail!"); } else return SendClientMessage(playerid, 0x2641FEAA, "No suspect near the jail!"); } else return SendClientMessage(playerid, 0x2641FEAA, "Jailtime cant be shorter then 1 or longer then 10"); } else return SendClientMessage(playerid, 0x2641FEAA, "USAGE: /arrest [Playername] [JailTime] [price]"); } else return SendClientMessage(playerid, 0x2641FEAA, "You are not a cop!"); return 1; } |