08.08.2012, 20:44
Aaaa... OK. Now I understand.
Actually, it's strange your problem because if you do that (let's suppose that hood is open and trunk closed):
pawn Код:
CMD:hood(playerid, params[])
{
new vehicleid,engine,lights,alarm,doors,bonnet,boot,objective;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not in a vehicle.");
if(GetPlayerVehicleSeat(playerid) != 0)
return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not in the drivers seat.");
if(bonnet == 1)
{
if(boot == VEHICLE_PARAMS_ON)
{
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,0,VEHICLE_PARAMS_ON,objective);
} else {
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,objective);
}
}
else
{
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,1,boot,objective);
}
return 1;
}
CMD:trunk(playerid, params[])
{
new vehicleid,engine,lights,alarm,doors,bonnet,boot,objective;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not in a vehicle.");
if(GetPlayerVehicleSeat(playerid) != 0)
return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not in the drivers seat.");
if(boot == VEHICLE_PARAMS_ON)
{
if(bonnet == 1)
{
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,0,objective);
} else {
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,VEHICLE_PARAMS_OFF,objective);
}
}
else
{
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,1,objective);
}
return 1;
}
pawn Код:
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
//Return: vehicleid, 0, 0, 0, 0, 1, 0, 0
//And we set them again with same values just changing trunk to true.
SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_on,objective);
//Everything else should be the same, except the trunk.