/detain cmd
#1

Hello, does anyone can tell me whats wrong with this cmd? when i do /detain [ID] [seatid] nothing happens

Код:
if(strcmp(cmd, "/detain", true) == 0)
{
   if(IsPlayerConnected(playerid))
   {
		if(PlayerInfo[playerid][pMember] == 1)
		{
			if(IsPlayerInAnyVehicle(playerid))
		   {
		       SendClientMessage(playerid, COLOR_GREY, "   Cannot use this while being in the Car !");
		       return 1;
		   }
    		    tmp = strtok(cmdtext, idx);
		    if (!strlen(tmp))
	      	return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [playerid/PartOfName] [seatid]");
            giveplayerid = ReturnUser(tmp);

		 	tmp = strtok(cmdtext, idx);
		    if (!strlen(tmp))
			return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /detain [playerid/PartOfName] [seatid]");
			new seat = strval(tmp);
			if(IsPlayerConnected(giveplayerid))
			{
			   if(giveplayerid != INVALID_PLAYER_ID)
			   {
		            if(seat < 1 || seat > 3) // this stays, that or the moron /detain'ing will put his suspect as driver
		            {
		                 SendClientMessage(playerid, COLOR_GRAD1, "The Seat ID cannot be above 3 or below 1.");
		   				 return 1;
					}
					if(PlayerInfo[playerid][pMember] == 1) //ovbiously, you know what this does
					{
					SendClientMessage(playerid, COLOR_GREY, "   You can't Detain Cops !");
					return 1;
					}
					if(IsPlayerInAnyVehicle(giveplayerid)) // no need to explain
					{
						SendClientMessage(playerid, COLOR_GREY, "   Suspect is in a Car, get him out first !");
						return 1;
					}
					if (ProxDetectorS(8.0, playerid, giveplayerid))
					{
					   if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You cannot Detain yourself!"); return 1; }
					   if(PlayerCuffed[giveplayerid] == 2)
					   {
 					   new carid = gLastCar[playerid];
					   new Float:DPositions[3][3];
					   GetPlayerPos( playerid, DPositions[0][0], DPositions[0][1], DPositions[0][2]);
					   GetPlayerPos( giveplayerid, DPositions[1][0], DPositions[1][1], DPositions[1][2]);
					   GetVehiclePos( carid, DPositions[2][0], DPositions[2][1], DPositions[2][2]); // makes it so you need to be close to your car

				 			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							format(string, sizeof(string), "* You were detained by %s .", sendername);
							SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "* You detained %s .", giveplayer);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "* %s throws %s in the back of his car.", sendername ,giveplayer);
							ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
							GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
							ClearAnimations(giveplayerid);
							TogglePlayerControllable(giveplayerid, 0);
							PutPlayerInVehicle(giveplayerid,carid,seat);
					   	}
						else
						{
						    SendClientMessage(playerid, COLOR_GREY, "   That player isn't Restrained !"); // for this, i have a /cuff
						    return 1;
						}
					}
					else
				{
					   SendClientMessage(playerid, COLOR_GREY, " Your not close enough to the player or your car!"); // fixed
					   return 1;
					}
				}
			}
			else
			{
			   SendClientMessage(playerid, COLOR_GREY, "   That player is Offline !");
			return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "   You are not a Cop / FBI / National Guard");
		}
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)