Lock & unlock vehicle
#1

Hi,

Why this command doesn't working correctly? I always got message "Vehicle is locked". I want to make, if vehicle is locked - unlock it and if unlocked - lock.

Код:
COMMAND:asd(playerid, params[])
{
	new
		Tekstas[ 50 ],
		vehicleid = GetPlayerVehicleID( playerid ),
		engine,
		lights,
		alarm,
		doors,
		bonnet,
		boot,
		objective
	;
	GetVehicleParamsEx( vehicleid, engine, lights, alarm, doors, bonnet, boot, objective );

	if( doors == VEHICLE_PARAMS_ON ) // Jeigu uћrakinta - atrakinam
	{
	    for( new i; i < MAX_PLAYERS; i++ )
	    {
			SetVehicleParamsForPlayerEx( vehicleid, i, 0, VEHICLE_PARAMS_OFF );
	    }
	    Tekstas = "Vehicle is unlocked";
	}
	else // Jeigu atrakinta - uћrakinam
	{
	    for( new i; i < MAX_PLAYERS; i++ )
	    {
			SetVehicleParamsForPlayerEx( vehicleid, i, 0, VEHICLE_PARAMS_ON );
	    }
	    Tekstas = "Vehicle is locked";
	}
	SendClientMessage( playerid, -1, Tekstas );
	return 1;
}
Код:
new
	VehiclesObj[ MAX_VEHICLES ][ MAX_PLAYERS ],
	VehiclesLock[ MAX_VEHICLES ][ MAX_PLAYERS ]
;
Код:
stock SetVehicleParamsForPlayerEx( vehicleid, playerid, objective, doors )
{
	VehiclesObj[ vehicleid ][ playerid ] = objective;
	VehiclesLock[ vehicleid ][ playerid ] = doors;
	if( IsVehicleStreamedIn( vehicleid, playerid ) )
	    return SetVehicleParamsForPlayer( vehicleid, playerid, objective, doors );
	return 1;
}
Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	SetVehicleParamsForPlayer( vehicleid, forplayerid, VehiclesObj[ vehicleid ][ forplayerid ], VehiclesLock[ vehicleid ][ forplayerid ] );
	return 1;
}
Thanks!
Reply


Messages In This Thread
Lock & unlock vehicle - by zgintasz - 03.01.2012, 14:25
Re: Lock & unlock vehicle - by FTLOG - 03.01.2012, 14:38
Re: Lock & unlock vehicle - by zgintasz - 03.01.2012, 15:04
Re: Lock & unlock vehicle - by FTLOG - 03.01.2012, 15:27
Re: Lock & unlock vehicle - by zgintasz - 03.01.2012, 15:51
Re: Lock & unlock vehicle - by FTLOG - 03.01.2012, 15:56

Forum Jump:


Users browsing this thread: 1 Guest(s)