Costody.. only works on id 0...
#1

Hello.
I made a Costody script, but
I can only release id 0.
This is my script. What have I done wrong?
pawn Код:
if(strcmp(cmd, "/rcostody",true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            if(PlayerToPoint(6.0, playerid, 222.9323,69.8237,1005.0391))
                {
            if(gTeam[playerid] == 2 || IsACop(playerid))
            {
                if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
                {
                  SendClientMessage(playerid, COLOR_GREY, "  You are not on Duty!");
                  return 1;
                }
                                if(PlayerInfo[giveplayerid][pCostody] == 0)
                {
                  SendClientMessage(playerid, COLOR_GREY, " The selected player is not in costody!");
                  return 1;
                }
        tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /rcostody [playerid/PartOfName]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if(IsPlayerConnected(giveplayerid))
            {
              if(giveplayerid != INVALID_PLAYER_ID)
              {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "* You released %s from costody.", giveplayer);
                    SendClientMessage(playerid, COLOR_LIGHTRED, string);
                    format(string, sizeof(string), "* You have been released from costody by Officer %s.", sendername);
                    SendClientMessage(giveplayerid, COLOR_LIGHTRED, string);
                    PlayerInfo[giveplayerid][pCostody] = 0;
                    SetPlayerPos(giveplayerid, 222.9323,69.8237,1005.0391);
                }
            }
      }
    }
}
      return 1;
}
Reply
#2

I have the same problem

Mac_Taylor
Reply
#3

Quote:
Originally Posted by manunited1878
I have the same problem

Mac_Taylor
Lol..
You are co-owner on my server, so yeah.. lol
Reply
#4

That's why because you're using giveplayerid before ReturnUser function which is meant to find the ID of the player.
Quote:
Originally Posted by Chrham_2
pawn Код:
if(PlayerInfo[giveplayerid][pCostody] == 0)
{
  SendClientMessage(playerid, COLOR_GREY, " The selected player is not in costody!");
   return 1;
}
Reply
#5

Quote:
Originally Posted by Don Correlli
That's why because you're using giveplayerid before ReturnUser function which is meant to find the ID of the player.
Quote:
Originally Posted by Chrham_2
pawn Код:
if(PlayerInfo[giveplayerid][pCostody] == 0)
{
  SendClientMessage(playerid, COLOR_GREY, " The selected player is not in costody!");
  return 1;
}
Thanks so much!!
Reply
#6

You're welcome.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)