Rob and arrest commands
#1

How exactly does one make it so that when a player types /rob or /arrest for example without the need of adding the id number of the player your typing to /rob/arrest so that it would /rob nearest player or /arrest the nearest player with 4+ stars
Reply
#2

The best place to start would be searching the forum for those commands.

The search would most likely return some scripts or gamemodes that you can look at.

Learn from other peoples examples. After the 1million'th thread about "how to arrest suspect plz" it gets a bit boring.
Reply
#3

I didnt ask to how to arrest suspect i already have that down i was asking how to remove the id name
I did do a quick check around the forums before and after the post i made and my post came up as the main one for most things i checked for and the rest of them where asking how to actually make the arrest suspect which again i dont need.

I have also tried learning from other peopls examples but most that i have checked again have the [id] in the command which is not what i want.
Reply
#4

http://pastebin.com/f5a658597

Next time, take 30 seconds of your time to search, because I actually found that link in a minute or even lower.
Reply
#5

pawn Код:
dcmd_ar(playerid, params[])
{
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "Usage: /ar (id/name)");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected.");
    if(IsPlayerNPC(id)) return SendClientMessage(playerid,COLOR_RED,"You cannot arrest an NPC!");
    if(playerid == id) return SendClientMessage(playerid,COLOR_RED,"You can not arrest yourself"); }
    ArrestPlayer(id);
}
Reply
#6

@ HAKAM - Well i actually did do a search for more than 30 seconds and seems your 1 minute search was as bad as mine or maybe you did not read the post.
Im not looking for a rob command where i have to do /rob [id] i was looking for just /rob which will rob the cloest player the filterscript you posted is /rob [id]...

@ KyleSmith - Thanks but thats /ar [id] and isnt what im looking for but thanks anyways.
Reply
#7

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
pawn Код:
dcmd_ar(playerid, params[])
{
    if(isnull(params))
    {
        new closest = GetClosestArrestable(playerid);
        if(closest == -1 || GetDistanceBetweenPlayers(playerid,closest) > 5) return SendClientMessage(playerid,COLOR_RED,"There are no players closes enough that you can arrest");

        if(GetPlayerWantedLevel(closest) <= 3) return SendClientMessage(playerid, COLOR_RED,"You cannot arrest that player. Their wanted level is too low");    

        ArrestPlayer(closest);
    }
}
Here, Ive edited.
Reply
#8

Use this code for GetClosestArrestable

http://pastebin.com/dbNE8EA8
Reply
#9

LMAO You just need to remove the check for an ID and replace it with an "IsPlayerInRangeOfPoint" after looping through MAX_PLAYERS. You'll have some additional editing, but 'eh...
Reply
#10

@ KyleSmith Thanks still getting a few warnings/errors lol but eh im still only just learning lol thanks

@realcop228 Hmm not sure what the looping through MAX_PLAYERS is but ill ****** it now haha thanks.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)