Car doors not opening
#1

Hello, I've got a little problem. I've made a system which allows the player to open a vehicle's doors if he/she has an object in their slot 3.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/abrirvehiculo", cmdtext, true, 10) == 0)
	{
		if(IsPlayerNearVehicle(playerid, vt1, 10.0) && IsPlayerAttachedObjectSlotUsed(playerid, 3))
		{
  			SetVehicleParamsForPlayer(vt1, playerid, 0, 0);
			SetVehicleParamsEx(vt1, 1, 0, 0, 0, 0, 0, 0);
 			SendClientMessage(playerid, RED, "Has forzado la cerradura del vehiculo.");
		}
		return 1;
	}
	return 0;
}
Before doing /abrirvehiculo, the character doesn't even try to open it, all good. But after doing /abrirvehiculo with the third slot used, the car doors should be open, but the character tries to open the door instead, and it isn't open. Can aynone help me? Thanks!
Reply
#2

vt1, what is it?
Reply
#3

The vehicle id, In OnGamemodeInIt I did this:


vt1 = CreateVehicle(431, 822.068603, -1636.192016, 13.390607, 120.873840, -1, -1, 0);
Reply
#4

EDIT: Never mind you seem to have already done this.
Reply
#5

EDIT.
Reply
#6

By the way, I did this:

SetVehicleParamsForPlayer(vt1, i, 0, 1);

In both OnVehicleSpawn and OnVehicleStreamIn.
Reply
#7

Since you have a SendClientMessage, when doing the command, does it show the Message?
If not:
Show me the definition of this:
IsPlayerNearVehicle
Reply
#8

Quote:
Originally Posted by notime
Посмотреть сообщение
Since you have a SendClientMessage, when doing the command, does it show the Message?
If not:
Show me the definition of this:
IsPlayerNearVehicle
It shows the message, and after doing /abrirvehiculo, the character does the anim trying to open the door, which doesnt happem before doing the command.
Reply
#9

I remember something like this.
Put the SetVehicleForPlayerPArams twice in there, like this:
pawn Код:
SetVehicleParamsForPlayer(vt1, playerid, 0, 0);
SetVehicleParamsForPlayer(vt1, playerid, 0, 0);
I've had this in the past that it just doesnt open.
Reply
#10

Quote:
Originally Posted by notime
Посмотреть сообщение
I remember something like this.
Put the SetVehicleForPlayerPArams twice in there, like this:
pawn Код:
SetVehicleParamsForPlayer(vt1, playerid, 0, 0);
SetVehicleParamsForPlayer(vt1, playerid, 0, 0);
I've had this in the past that it just doesnt open.
Alright, did it and didn't work :/ I deleted the SetVehicleParamsEx though, did I have to keep it with the two SetVehicleParamsForPlayer?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)