detain problem
#3

Код:
CMD:detain(playerid, params[]) {
	new
		seat,
		targetID;

	if(sscanf(params, "ud", targetID, seat))
		return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/detain [playerid] [seat (1-3)]");

	if(playerVariables[targetID][pFreezeType] == 2 || playerVariables[targetID][pFreezeType] == 4) {
		if(seat > 0 && seat < 4) {
			if(IsPlayerInRangeOfPlayer(playerid, targetID, 5.0) && IsPlayerInRangeOfVehicle(playerid, GetClosestVehicle(playerid), 5.0)) {

				new
					detaintarget = GetClosestVehicle(playerid);

				if(checkVehicleSeat(detaintarget, seat) != 0) SendClientMessage(playerid, COLOR_GREY, "That seat ID is occupied.");

				else {

					new
						playerName[2][MAX_PLAYER_NAME],
						string[92];

					GetPlayerName(playerid, playerName[0], MAX_PLAYER_NAME);
					GetPlayerName(targetID, playerName[1], MAX_PLAYER_NAME);

					format(string, sizeof(string), "* %s has been detained into the vehicle by %s.", playerName[1], playerName[0]);
					nearByMessage(playerid, COLOR_PURPLE, string);

					PutPlayerInVehicle(targetID, detaintarget, seat);
				}
			}
			else SendClientMessage(playerid, COLOR_GREY, "You must be closer to the player you wish to detain, and the vehicle you wish to detain into.");
	    }
	}
	return 1;
}
Reply


Messages In This Thread
detain problem - by Strafe - 20.05.2012, 15:39
Re: detain problem - by [FMJ]PowerSurge - 20.05.2012, 15:49
Re: detain problem - by Strafe - 20.05.2012, 16:00
Re: detain problem - by Strafe - 22.05.2012, 19:36
Re: detain problem - by [FMJ]PowerSurge - 22.05.2012, 21:09

Forum Jump:


Users browsing this thread: 1 Guest(s)