AR Command.
#1

I've creating a arrest command but its not worked When I'm typing /ar Trying to arrest someone They are not shown me anythingg

PHP код:
CMD:ar(playeridparams[])
{
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[400];
    new 
Float:targetidpos[3];
    if(
GetTeam{playerid} == CLASS_CIV || GetTeam{playerid} == CLASS_MEDIC) return SendClientMessage(playeridRED"Only law enforcement can arrest players.");
    if(
GetPlayerInterior(targetid) > 0) return SendClientMessage(playeridred"ERROR: You can't arrest players inside an interior.");
    if(
sscanf(params"ui"targetid)) SendClientMessage(playeridCOLOR_WHITE"{FF0000}[POLICE]: {FFFFFF}/arrest(/ar) [ID / NAME]");
    if(
GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[Please wait]: {FFFFFF}Just Wait 5 seconds before arresting a suspect again.");
    if(
PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playeridred"This player is already in jail,you can't arrest him.");
    if(
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle.");
    if(
GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playeridred"{FF0000}ERROR: {FFFFFF}No nearby players are wanted highly enough to receive a ticket.");
    if(
playerid == targetid) return SendClientMessage(playerid,red"[ERROR]: You cannot arrest yourself.");
    if(
playeridgTeam[playerid] == CLASS_COPS && gTeam[targetid] == CLASS_ARMY && gTeam[playerid] == CLASS_SWAT && gTeam[playerid] == CLASS_CIA && gTeam[playerid] == CLASS_FBI) return SendClientMessage(playerid,red"You can't arrest who is in your team.");
    
GetPlayerPos(targetidtargetidpos[0], targetidpos[1], targetidpos[2]);
    if (!
IsPlayerInRangeOfPoint(playerid5.0targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1"Nobody close enough to arrest.");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(targetidtNamesizeof(tName));
    if(
IsPlayerConnected(targetid))
        {
            if(
GetTeam{playerid} == CLASS_COPS)
            {
                new 
ArrestReward random(15000) + 2500;
                  if(
ArrestReward GetPlayerCash(playerid))
                if(
GetPlayerWantedLevel(targetid) >= 4&100)
                
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
                   
BeginArrested[targetid] = 1;
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
                
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
                
SendClientMessage(playeridredstring);
                
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {308AFF}Officer %s(%d){FFFFFF}! Location: %s"tNametargetidpNameplayerid);
                
SendClientMessageToAll(yellowstring);
                
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
                
GameTextForPlayer(playeridstring70005);
                
GivePlayerMoney(playeridArrestReward);
                
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
                
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
                
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
                
pJailCount[targetid] = 20 random(40);
                new 
Random random(sizeof(RandomJailSpawns));
                
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
                
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]);
                
ResetPlayerWeapons(targetid);
                
SetPlayerInterior(targetid10);
                
SetPlayerWantedLevel(targetid,0);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
            }
         }
         return 
1;

Reply
#2

it doesnt shows any message from here?
Код:
    if(GetTeam{playerid} == CLASS_CIV || GetTeam{playerid} == CLASS_MEDIC) return SendClientMessage(playerid, RED, "Only law enforcement can arrest players."); 
    if(GetPlayerInterior(targetid) > 0) return SendClientMessage(playerid, red, "ERROR: You can't arrest players inside an interior."); 
    if(sscanf(params, "ui", targetid)) SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[POLICE]: {FFFFFF}/arrest(/ar) [ID / NAME]"); 
    if(GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[Please wait]: {FFFFFF}Just Wait 5 seconds before arresting a suspect again."); 
    if(PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playerid, red, "This player is already in jail,you can't arrest him."); 
    if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle."); 
    if(GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playerid, red, "{FF0000}ERROR: {FFFFFF}No nearby players are wanted highly enough to receive a ticket."); 
    if(playerid == targetid) return SendClientMessage(playerid,red, "[ERROR]: You cannot arrest yourself."); 
    if(playerid, gTeam[playerid] == CLASS_COPS && gTeam[targetid] == CLASS_ARMY && gTeam[playerid] == CLASS_SWAT && gTeam[playerid] == CLASS_CIA && gTeam[playerid] == CLASS_FBI) return SendClientMessage(playerid,red, "You can't arrest who is in your team."); 
    GetPlayerPos(targetid, 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.");
Reply
#3

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
it doesnt shows any message from here?
Код:
    if(GetTeam{playerid} == CLASS_CIV || GetTeam{playerid} == CLASS_MEDIC) return SendClientMessage(playerid, RED, "Only law enforcement can arrest players."); 
    if(GetPlayerInterior(targetid) > 0) return SendClientMessage(playerid, red, "ERROR: You can't arrest players inside an interior."); 
    if(sscanf(params, "ui", targetid)) SendClientMessage(playerid, COLOR_WHITE, "{FF0000}[POLICE]: {FFFFFF}/arrest(/ar) [ID / NAME]"); 
    if(GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[Please wait]: {FFFFFF}Just Wait 5 seconds before arresting a suspect again."); 
    if(PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playerid, red, "This player is already in jail,you can't arrest him."); 
    if(IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle."); 
    if(GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playerid, red, "{FF0000}ERROR: {FFFFFF}No nearby players are wanted highly enough to receive a ticket."); 
    if(playerid == targetid) return SendClientMessage(playerid,red, "[ERROR]: You cannot arrest yourself."); 
    if(playerid, gTeam[playerid] == CLASS_COPS && gTeam[targetid] == CLASS_ARMY && gTeam[playerid] == CLASS_SWAT && gTeam[playerid] == CLASS_CIA && gTeam[playerid] == CLASS_FBI) return SendClientMessage(playerid,red, "You can't arrest who is in your team."); 
    GetPlayerPos(targetid, 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.");
yes why?
Reply
#4

so you mean there's no any kind of messages or something like this?
Reply
#5

When I'm trying to use /ar to arrest someone for testing and he have +4wanted level I can't arrest him.. I think the problem with Class_Cops?
Reply
#6

than it must be
if(GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playerid, red, "{FF0000}ERROR: {FFFFFF}No nearby players are wanted highly enough to receive a ticket."); <-- use this if u want to arrest all of the players who have a at least one wanted level
Reply
#7

Hi agian, Its not work anymore. and there a problem again.. Everyone can use /ar why? I want put /ar for only police/fbi/swat/army/cia...
Reply
#8

PHP код:
CMD:ar(playeridparams[])
{
    new 
pName[MAX_PLAYER_NAME], tName[MAX_PLAYER_NAME], targetidstring[400];
    new 
Float:targetidpos[3];
    if(
GetTeam(playerid) == CLASS_CIV || GetTeam(playerid) == CLASS_MEDIC)
        return 
SendClientMessage(playeridRED"Only law enforcement can arrest players.");
        
    if(
GetPlayerInterior(targetid) > 0) return SendClientMessage(playeridred"ERROR: You can't arrest players inside an interior.");
    if(
sscanf(params"ui"targetid)) SendClientMessage(playeridCOLOR_WHITE"{FF0000}[POLICE]: {FFFFFF}/arrest(/ar) [ID / NAME]");
    if(
GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"{FF0000}[Please wait]: {FFFFFF}Just Wait 5 seconds before arresting a suspect again.");
    if(
PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playeridred"This player is already in jail,you can't arrest him.");
    if(
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle.");
    if(
GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playeridred"{FF0000}ERROR: {FFFFFF}No nearby players are wanted highly enough to receive a ticket.");
    if(
playerid == targetid) return SendClientMessage(playerid,red"[ERROR]: You cannot arrest yourself.");
    if(
playeridgTeam[playerid] == CLASS_COPS && gTeam[targetid] == CLASS_ARMY && gTeam[playerid] == CLASS_SWAT && gTeam[playerid] == CLASS_CIA && gTeam[playerid] == CLASS_FBI) return SendClientMessage(playerid,red"You can't arrest who is in your team.");
    
GetPlayerPos(targetidtargetidpos[0], targetidpos[1], targetidpos[2]);
    if(!
IsPlayerInRangeOfPoint(playerid5.0targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1"Nobody close enough to arrest.");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(targetidtNamesizeof(tName));
    
    if(
IsPlayerConnected(targetid))
    {
        if(
GetTeam(playerid) == CLASS_COPS)
        {
            new 
ArrestReward random(15000) + 2500;
            if(
ArrestReward GetPlayerCash(playerid))
             if(
GetPlayerWantedLevel(targetid) >= 4&100)
              
TimerArrest[targetid] = SetTimerEx("BeginArrestedTimer"10000false,"i"targetid); // 10 Secdons timer
               
BeginArrested[targetid] = 1;
               
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
               
SetPlayerAttachedObject(targetid8194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
            
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}Law Enforcement Officer %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
            
format(stringsizeof(string), "You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
            
SendClientMessage(targetid, -1"{0080FF}[BEING ARRESTED]: {FFFFFF}Use {0080FF}/breakcuffs (/bc) {FFFFFF}to attempt to evade the Arrest.");
               
format(stringsizeof(string), "{ffffff}You have Arrested {FFD700}%s(%d){FFFFFF}. You have received {33FF33}$%d {FFFFFF}for this Arrest."tNametargetidArrestReward);
            
SendClientMessage(playeridredstring);
            
format(stringsizeof(string), "{0080FF}[ARRESTED]: {FFD700}%s(%d) {FFFFFF}has been {33CCFF}Arrested {FFFFFF}by {308AFF}Officer %s(%d){FFFFFF}! Location: %s"tNametargetidpNameplayerid);
            
SendClientMessageToAll(yellowstring);
            
format(stringsizeof(string), "~w~You have ~G~Arrested ~Y~%s(%d)~n~n~You have received ~n~n~~y~$%d ~w~for this Arrest."tNametargetidArrestReward);
            
GameTextForPlayer(playeridstring70005);
            
GivePlayerMoney(playeridArrestReward);
            
SetPlayerScore(playeridGetPlayerScore(playerid)+1);
            
SetPlayerScore(playeridGetPlayerScore(targetid)-1);
            
pJailTimerID[targetid] = SetTimerEx("pJailTimer"3000true"i"targetid);
            
pJailCount[targetid] = 20 random(40);
            new 
Random random(sizeof(RandomJailSpawns));
            
SetPlayerPos(targetidRandomJailSpawns[Random][0], RandomJailSpawns[Random][1], RandomJailSpawns[Random][2]);
            
SetPlayerFacingAngle(targetidRandomJailSpawns[Random][2]);
            
ResetPlayerWeapons(targetid);
            
SetPlayerInterior(targetid10);
            
SetPlayerWantedLevel(targetid,0);
            
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)