Vehicle doors state bug
#1

Hi!
I check out new scripting functions and i think i found a bug. The doors state is not being updated after i close/open the doors.
Here is my code:
Код:
CMD:opentest(playerid, params[])
{
	new tdoor, dstate[4];
	if(sscanf(params, "i", tdoor)) return SCM(playerid, -1, "USAGE: /opentest [doorid]");
	if(tdoor < 4 && tdoor >= 0)
	{
		if(GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID)
		{
			GetVehicleParamsCarDoors(GetPlayerVehicleID(playerid), dstate[0], dstate[1], dstate[2], dstate[3]);
			SCMF(playerid, -1, "0: %i , 1: %i, 2: %i, 3: %i, doorid: %i", dstate[0], dstate[1], dstate[2], dstate[3], tdoor);
			if(dstate[tdoor] == 0 || dstate[tdoor] == -1)
			{
				dstate[tdoor] = 1; 
				SetVehicleParamsCarDoors(GetPlayerVehicleID(playerid), dstate[0], dstate[1], dstate[2], dstate[3]);
			}
			else SCM(playerid, -1, "The door is already opened");
		}
	}
	return 1;
}
CMD:closetest(playerid, params[])
{
	new tdoor, dstate[4];
	if(sscanf(params, "i", tdoor)) return SCM(playerid, -1, "USAGE: /closetest [doorid]");
	if(tdoor < 4 && tdoor >= 0)
	{
		if(GetPlayerVehicleID(playerid) != INVALID_VEHICLE_ID)
		{
			GetVehicleParamsCarDoors(GetPlayerVehicleID(playerid), dstate[0], dstate[1], dstate[2], dstate[3]);
			SCMF(playerid, -1, "0: %i , 1: %i, 2: %i, 3: %i, doorid: %i", dstate[0], dstate[1], dstate[2], dstate[3], tdoor);
			if(dstate[tdoor] == 1)
			{
				dstate[tdoor] = 0; 
				SetVehicleParamsCarDoors(GetPlayerVehicleID(playerid), dstate[0], dstate[1], dstate[2], dstate[3]);
			}
			else SCM(playerid, -1, "The door is already closed");
		}
	}
	return 1;
}

CMD:doorsstate(playerid, params[])
{
	new cardoorstate[4];
	GetVehicleParamsCarDoors(GetPlayerVehicleID(playerid), cardoorstate[0], cardoorstate[1], cardoorstate[2], cardoorstate[3]);
	SCMF(playerid, -1, "0: %i , 1: %i, 2: %i, 3: %i", cardoorstate[0], cardoorstate[1], cardoorstate[2], cardoorstate[3]);
	return 1;
}
Here is a video:

https://www.youtube.com/watch?v=Orob...ature=*********
Sorry for my bad english.
Reply
#2

Hello!

That is no bug.
You have to define this global:
PHP код:
new tdoordstate[4]; 
Reply
#3

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

That is no bug.
You have to define this global:
PHP код:
new tdoordstate[4]; 
False, this has absolutely nothing to do with the problem.
Reply
#4

Oh, you are right, sorry.
I am a little bit tired.. ^^
Reply
#5

Do not use GetVehicleParamsCarDoors for getting current doors state.
More information about this here: https://sampforum.blast.hk/showthread.php?tid=571441
Reply
#6

Quote:
Originally Posted by ZiGGi
Посмотреть сообщение
Do not use GetVehicleParamsCarDoors for getting current doors state.
More information about this here: https://sampforum.blast.hk/showthread.php?tid=571441
Thanks
Reply


Forum Jump:


Users browsing this thread: