[HELP] /arrest problem
#1

I'm trying to create a /arrest command that put a playerid in the jail.

When I type /arrest in the PlayerToPoint and a ID nothing happends...

pawn Код:
if(strcmp(cmd, "/arrest", true) == 0)
    {
         if(IsPlayerConnected(playerid))
        {
            if(gTeam[playerid] == 2 && gTeam[playerid] == 3)
            {
                if(gPlayerLogged[playerid] == 0)
                {
                    SendClientMessage(playerid, COLOR_GREY, "    You are not logged in yet.");
                    return 1;
                }
                if(PlayerToPoint(5.0, playerid, 629.9667,-584.9457,16.3359))
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GREY, "    USAGE: /arrest [playerid/PartOfName] [price] [minutes]");
                        return 1;
                    }
                    moneys = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GREY, "    USAGE: /arrest [playerid/PartOfName] [price] [minutes]");
                        return 1;
                    }
                    new time = strval(tmp);
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GREY, "    USAGE: /arrest [playerid/PartOfName] [price] [minutes]");
                        return 1;
                    }
                    giveplayerid = ReturnUser(tmp);
                    if(IsPlayerConnected(giveplayerid))
                    {
                        if(giveplayerid != INVALID_PLAYER_ID)
                        {
                            if(ProxDetectorS(8.0, playerid, giveplayerid))
                            {
                                new rank[50];
                                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                format(string, sizeof(string), "* You arrested %s!", giveplayer);
                                SendClientMessage(playerid, COLOR_WHITE, string);
                                GivePlayerMoney(giveplayerid, -moneys);
                                format(string, sizeof(string), "arrested by %s ~n~    for $%d", sendername, moneys);
                                GameTextForPlayer(giveplayerid, string, 5000, 5);
                                ResetPlayerWeapons(giveplayerid);
                                if(gTeam[playerid] == 2)
                                {
                                    if(PlayerInfo[giveplayerid][pRank] == 10) { rank = "Chief of Police"; }
                                    else if(PlayerInfo[playerid][pRank] == 9) { rank = "Assistant Chief"; }
                                    else if(PlayerInfo[playerid][pRank] == 8) { rank = "Commander"; }
                                    else if(PlayerInfo[playerid][pRank] == 7) { rank = "Captain"; }
                                    else if(PlayerInfo[playerid][pRank] == 6) { rank = "Lieutenant"; }
                                    else if(PlayerInfo[playerid][pRank] == 5) { rank = "Staff Sergeant"; }
                                    else if(PlayerInfo[playerid][pRank] == 4) { rank = "Sergeant"; }
                                    else if(PlayerInfo[playerid][pRank] == 3) { rank = "Senior Lead Officer"; }
                                    else if(PlayerInfo[playerid][pRank] == 2) { rank = "Police Officer II"; }
                                    else if(PlayerInfo[playerid][pRank] == 1) { rank = "Police Officer I"; }
                                }
                                else if(gTeam[playerid] == 3)
                                {
                                    if(PlayerInfo[playerid][pRank] == 10) { rank = "Sheriff"; }
                                    else if(PlayerInfo[playerid][pRank] == 9) { rank = "Undersheriff"; }
                                    else if(PlayerInfo[playerid][pRank] == 8) { rank = "Assistant Sheriff"; }
                                    else if(PlayerInfo[playerid][pRank] == 7) { rank = "Captain"; }
                                    else if(PlayerInfo[playerid][pRank] == 6) { rank = "Lieutenant"; }
                                    else if(PlayerInfo[playerid][pRank] == 5) { rank = "Sergeant"; }
                                    else if(PlayerInfo[playerid][pRank] == 4) { rank = "Corporal"; }
                                    else if(PlayerInfo[playerid][pRank] == 3) { rank = "Deputy Sheriff II"; }
                                    else if(PlayerInfo[playerid][pRank] == 2) { rank = "Deputy Sheriff I"; }
                                    else if(PlayerInfo[playerid][pRank] == 1) { rank = "Deputy Sheriff Generalist"; }
                                }
                                SetPlayerInterior(giveplayerid, 6);
                                SetPlayerPos(giveplayerid, 264.6288,77.5742,1001.0391);
                                PlayerInfo[giveplayerid][pJailTime] = time * 60;
                                PlayerInfo[giveplayerid][pJailed] = 1;
                                SetPlayerFree(giveplayerid, playerid, "Got Arrested");
                                format(string, sizeof(string), "[Jail] %s has been arrested by %s %s.", giveplayerid, rank, sendername);
                                SendClientMessageToAll(COLOR_LIGHT_RED, string);
                            }
                        }
                    }
                }
            }
        }
        return 1;
    }
Thanks
Reply
#2

Код:
if(gTeam[playerid] == 2 && gTeam[playerid] == 3)
            {
(your 5th line)
This is impossible... 1 variable can't have 2 different numbers... I don't know whether this is the whole problem, however this is 1 part of it...
replace it with:
Код:
if(gTeam[playerid] == 2 || gTeam[playerid] == 3)
            {
Reply
#3

Quote:
Originally Posted by Sascha
Посмотреть сообщение
Код:
if(gTeam[playerid] == 2 && gTeam[playerid] == 3)
            {
(your 5th line)
This is impossible... 1 variable can't have 2 different numbers... I don't know whether this is the whole problem, however this is 1 part of it...
replace it with:
Код:
if(gTeam[playerid] == 2 || gTeam[playerid] == 3)
            {
Well, this fixed a part of the script but I still can't arrest someone, nothing happend when I type /arrest 1 100 5 for example. "Arrest ID 1 for $100 in 5 minutes"
Reply
#4

Ahh whats this?
Код:
if(PlayerToPoint(5.0, playerid, 629.9667,-584.9457,16.3359))
Reply
#5

Quote:
Originally Posted by <Weponz>
Посмотреть сообщение
Ahh whats this?
Код:
if(PlayerToPoint(5.0, playerid, 629.9667,-584.9457,16.3359))
It's the position you have to be in to be able to arrest someone, and yes, I stand in the position xD
Reply
#6

wats 5.0 do
Reply
#7

Quote:
Originally Posted by <Weponz>
Посмотреть сообщение
wats 5.0 do
The radius I think?
Reply
#8

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
The radius I think?
Wouldnt it be 5 Then? For 5 metres? Maybe 5.0 is tripping the pawno out xD
Reply
#9

Quote:
Originally Posted by <Weponz>
Посмотреть сообщение
Wouldnt it be 5 Then? For 5 metres? Maybe 5.0 is tripping the pawno out xD
Dudes, this got nothing to do with my problem, the PlayerToPont works, I just cant arrest a playerid...
Reply
#10

Quote:
Originally Posted by <Weponz>
Посмотреть сообщение
Wouldnt it be 5 Then? For 5 metres? Maybe 5.0 is tripping the pawno out xD
/facepalm

All distances are floats and in units
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)