23.04.2018, 12:24
Hi guys! I have a problem and I want you to help! I have created a word for the police to catch people but I want to add time I mean after a cop arrest someone give him extra +5secdons to use the command again! How to do that?
PHP код:
CMD:ar(playerid, params[])
{
if(!PoliceTeam(GetPlayerSkin(playerid))) return SendClientMessage(playerid, 0xE74C3CFF, "{FF0000}Error: {FFFFFF}Only Law Enforcement may use this command.");
new pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[128];
new Float:targetidpos[3];
if(GetPlayerInterior(targetid) > 0) return SendClientMessage(playerid, red, "{FF0000}Error: {ffffff} You can't arrest players inside an interior.");
if(sscanf(params, "ui", playerid)) SendClientMessage(playerid, COLOR_WHITE, "{E66144}[POLICE]{FFFFFF}: /Arrest(/AR) [Username /ID]. ");
if(GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}Error: {ffffff}Please wait 5 seconds before arresting a suspect again.");
if(PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playerid, red, "{FF0000}Error: {ffffff}This player is already in jail,you can't arrest him.");
if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"{FF0000}Error: {ffffff}You can't arrest players if they're in a vehicle.");
if(GetPlayerWantedLevel(targetid) == 3) return SendClientMessage(playerid, red, "{FF0000}Error: {ffffff} You can't arrest players with wanted level lower than, Use /tk to issue a ticket.");
if(GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playerid, red, "{FF0000}Error: {ffffff}This player is not wanted,you can't arrest him");
if(playerid == targetid) return SendClientMessage(playerid,red, "{FF0000}Error: {ffffff}You cannot arrest yourself.");
if(gTeam[playerid] == CLASS_COPS && gTeam[playerid] == CLASS_CIA && gTeam[playerid] == CLASS_SWAT && gTeam[playerid] == CLASS_ARMY) return SendClientMessage(playerid,red, "You can't arrest who is in your team.");
GetPlayerPos(playerid, targetidpos[0], targetidpos[1], targetidpos[2]);
if (!IsPlayerInRangeOfPoint(playerid, 5.0, targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1, "Nobody close enough to arrest.");
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(targetid, tName, sizeof(tName));
if(IsPlayerConnected(targetid))