27.02.2011, 04:52
I've saw how the enum was used in other ways, so i tried this:
Compiles fine, but doesn't seem to work. Any help will be appreciated
EDIT:
If you want to use this code, I tweaked it a little:
Usage:
Turns the engine on.
pawn Код:
enum enum_vParams
{
vBonnet,
vObjective,
vAlarm,
vDoors,
vEngine,
vBoot,
vLights
};
stock SetVehParams(vehicleid, param, status)
{
new
VehParams[7];
GetVehicleParamsEx(vehicleid, VehParams[0], VehParams[1], VehParams[2], VehParams[3], VehParams[4], VehParams[5], VehParams[6]);
switch(enum_vParams:param)
{
case vBonnet: VehParams[0] = status;
case vObjective: VehParams[1] = status;
case vAlarm: VehParams[2] = status;
case vDoors: VehParams[3] = status;
case vEngine: VehParams[4] = status;
case vBoot: VehParams[5] = status;
case vLights: VehParams[6] = status;
}
return SetVehicleParamsEx(vehicleid, VehParams[0], VehParams[1], VehParams[2], VehParams[3], VehParams[4], VehParams[5], VehParams[6]);
}
EDIT:
If you want to use this code, I tweaked it a little:
pawn Код:
enum enum_vParams
{
Engine,
Lights,
Alarm,
Doors,
Bonnet,
Boot,
Objective
};
stock SetVehParams(vehicleid, params, status)
{
new
VehParams[7];
GetVehicleParamsEx(vehicleid, VehParams[0], VehParams[1], VehParams[2], VehParams[3], VehParams[4], VehParams[5], VehParams[6]);
VehParams[enum_vParams:params] = status ? (1):(0);
return SetVehicleParamsEx(vehicleid, VehParams[0], VehParams[1], VehParams[2], VehParams[3], VehParams[4], VehParams[5], VehParams[6]);
}
pawn Код:
SetVehParams(GetPlayerVehicleID(playerid), Engine, VEHICLE_PARAMS_ON);