03.01.2012, 14:25
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.
Thanks!
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;
}


