[HELP] What is wrong with my /arrest command?
#1

As the title says:

Код:
if(strcmp(cmd, "/arrest", true) == 0)
    {
      	if(IsPlayerConnected(playerid))
        {
            if(gTeam[playerid] == 2 || gTeam[playerid] == 3)
            {
				tmp = strtok(cmdtext, idx);
    			if(!strlen(tmp))
       			{
          			SendClientMessage(playerid, COLOR_GREY, "	USAGE: /arrest [playerid/PartOfName] [minutes]");
             		return 1;
          		}
            	GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				new time = strval(tmp);
    			if(time < 1 || time > 60) { SendClientMessage(playerid, COLOR_GREY, "	Arrest time can not be over 60 minutes or lower than 1."); return 1; }
       			tmp = strtok(cmdtext, idx);
          		if(!strlen(tmp))
            	{
             		SendClientMessage(playerid, COLOR_GREY, "	USAGE: /arrest [playerid/PartOfName] [minutes]");
               		return 1;
             	}
              	if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 5)
               	{
                	if(PlayerToPoint(3.0, playerid, 645.6984,-613.6818,16.3396))
                 	{
						format(string, sizeof(string), "~r~You have been imprisoned in Los Santos Prison for %d minutes", time);
    					GameTextForPlayer(giveplayerid, string, 3000, 5);
    					SetPlayerPos(giveplayerid, 268.3327,77.8972,1001.0391);
       					GivePlayerMoney(giveplayerid, -5000);
					}
					else if(PlayerToPoint(3.0, playerid, 268.3327,77.8972,1001.0391))
     				{
						format(string, sizeof(string), "~r~You have been arrested in the Police Department for %d minutes", time);
    					GameTextForPlayer(giveplayerid, string, 3000, 5);
       					GivePlayerMoney(giveplayerid, -3000);
					}
    				ResetPlayerWeapons(giveplayerid);
					PlayerInfo[giveplayerid][pJailTime] = time * 60;
			 	}
			}
		}
		return 1;
    }
Thanks for your support!
Reply
#2

What doesn't it do that it's supposed to do?
Reply
#3

Quote:
Originally Posted by Calgon
Посмотреть сообщение
What doesn't it do that it's supposed to do?
As a cop gTeam[playerid] == 2 and gTeam[playerid] == 3 you should walk into a PlayerToPoint and type /arrest [id] [minutes] and the giveplayerid should be teleported to a prison cell and be relesed after the given minutes.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)