SA-MP Forums Archive
detain problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: detain problem (/showthread.php?tid=344308)



detain problem - Strafe - 20.05.2012

I'm using the Affliction Roleplay script, and I'm having problems with the detain command. After i cuff the player, and bring them over to the vehicle and stop dragging them. When I use the /detain command which has the params of

Use: /detain [PlayerID] [Seat 1-3]

When I detain the player it puts them in the seat in the car, but less that 3 seconds after they teleport out of the car.

Does anyone know if this is caused by a plugin that needs to be updated or if it's just a scripting error?


Re: detain problem - [FMJ]PowerSurge - 20.05.2012

It's more than likely a scripting error. Are you clearing their animations, setting new ones or something like that in another function? For example, in OnPlayerUpdate, you could be clearing their animations if they're in a car. Sitting down in a car is an animation, so it gets cleared which subsequently removes them from the car.


Re: detain problem - Strafe - 20.05.2012

Код:
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;
}



Re: detain problem - Strafe - 22.05.2012

Anyone?


Re: detain problem - [FMJ]PowerSurge - 22.05.2012

Again, is there anywhere else in the script that could interfere? Such as clearing animations in a car...