How can I make this -
#1

How can I add /prison [ID] onto this code? Because I want you to be able to prison a certin ID, not just anyone near.

pawn Код:
if(strcmp(cmd, "/prison", true) == 0)
    {
      if(IsPlayerConnected(playerid))
        {
      if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)
            {
                if(PlayerToPoint(10.0, playerid, 2736.9661,-2465.3228,13.6484))
                {
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "SYNTAX: /prison [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
                        return 1;
                    }
                    moneys = strval(tmp);
                    if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, "Prison Price can't be below $1 or above $99999!"); return 1; }
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "SYNTAX: /prison [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
                        return 1;
                    }
                    new time = strval(tmp);
                    if(time < 1 || time > 60) { SendClientMessage(playerid, COLOR_GREY, " Prison Time Minutes can't be below 1 or above 20 (Take the person to prison then)!"); return 1; }
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "SYNTAX: /prison [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
                        return 1;
                    }
                    new bail = strval(tmp);
                    if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, "  Prison Bailing can't be below 0 or above 1!"); return 1; }
                    tmp = strtok(cmdtext, idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "SYNTAX: /prison [price] [time (minutes)] [bail (0=no 1=yes)] [bailprice]");
                        return 1;
                    }
                    new bailprice = strval(tmp);
                    if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, "  Prison Bailing can't be below $0 or above $3000000!"); return 1; }
                    new suspect = GetClosestPlayer(playerid);
                    if(IsPlayerConnected(suspect))
                    {
                        if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
                        {
                            GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            if(WantedLevel[suspect] < 1)
                            {
                            SendClientMessage(playerid, COLOR_GREY, " Player must be at least Wanted Level 1!");
                            return 1;
                            }
                            format(string, sizeof(string), "* You placed %s in Prison", giveplayer);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            SafeGivePlayerMoney(suspect, -moneys);
                            format(string, sizeof(string), "You've been placed in prison by %s ~n~  for $%d", sendername, moneys);
                            GameTextForPlayer(suspect, string, 5000, 5);
                            SafeResetPlayerWeapons(suspect);
                            if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)
                            {
                              new currank[64];
                              new rtext[64];
                if(PlayerInfo[playerid][pRank] == 1) { rtext = "Private"; }
                                else if(PlayerInfo[playerid][pRank] == 2) { rtext = "Private First Class"; }
                                else if(PlayerInfo[playerid][pRank] == 3) { rtext = "Specialist"; }
                                else if(PlayerInfo[playerid][pRank] == 4) { rtext = "Sergeant"; }
                                else if(PlayerInfo[playerid][pRank] == 5) { rtext = "Staff Sergeant"; }
                              else if(PlayerInfo[playerid][pRank] == 6) { rtext = "Sergeant First Class"; }
                              else if(PlayerInfo[playerid][pRank] == 7) { rtext = "Master Sergeant"; }
                              else if(PlayerInfo[playerid][pRank] == 8) { rtext = "Command Sergeant Major"; }
                              else if(PlayerInfo[playerid][pRank] == 9) { rtext = "Sergeant Major"; }
                                else { rtext = "Private"; }
                                format(string, sizeof(string), "[Military] %s %s has just prisoned %s", currank ,sendername, giveplayer);
                                OOCNews(COLOR_BLUE, string);
                            }
                            SetPlayerInterior(suspect, 6);
                            SetPlayerPos(suspect,264.6288,77.5742,1001.0391);
                            PlayerInfo[suspect][pJailTime] = time * 60;
                            if(bail == 1)
                            {
                                JailPrice[suspect] = bailprice;
                                format(string, sizeof(string), "You are in prison for %d seconds.  Bail: $%d", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
                                SendClientMessage(suspect, COLOR_WHITE, string);
                            }
                            else
                            {
                              JailPrice[suspect] = 0;
                                format(string, sizeof(string), "You are in prison for %d seconds.  Bail: Unable", PlayerInfo[suspect][pJailTime]);
                                SendClientMessage(suspect, COLOR_WHITE, string);
                            }
                            PlayerInfo[suspect][pJailed] = 1;
                        PlayerInfo[suspect][pArrested] += 1;
                            SetPlayerFree(suspect,playerid, "Prisoned");
                            WantedPoints[suspect] = 0;
                            WantedLevel[suspect] = 0;
                            WantLawyer[suspect] = 1;
                        }//distance
                    }//not connected
                    else
                    {
                    SendClientMessage(playerid, COLOR_GREY, " No-one close enough to arrest.");
                    return 1;
                    }
                }
                else
                {
                  SendClientMessage(playerid, COLOR_GREY, "You're not in the prison spot.");
                  return 1;
                }
            }
            else
            {
              SendClientMessage(playerid, COLOR_GREY, " You are not a Military Soldier!");
              return 1;
            }
        }//not connected
        return 1;
    }
If someone could show me it'd be great. Also, I don't know why fucks up the indention..? :S
Reply
#2

Giving this a slight bump because it's back a few pages..
Reply
#3

Quote:
Originally Posted by Devine
Giving this a slight bump because it's back a few pages..
And again :P
Reply
#4

Just get a /prison command from a RP GM.
Reply
#5

I don't want the other ones I just want an ID that you can prison.
Reply
#6

Make seperate cmds
eg: /prison1 or /prison 2
with different co-ords ofc
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)