Help using enums
#5

Well this fixed it:
pawn Код:
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 ? (1):(0);
        case vObjective: VehParams[1] = status ? (1):(0);
        case vAlarm: VehParams[2] = status ? (1):(0);
        case vDoors: VehParams[3] = status ? (1):(0);
        case vEngine: VehParams[4] = status ? (1):(0);
        case vBoot: VehParams[5] = status ? (1):(0);
        case vLights: VehParams[6] = status ? (1):(0);
    }
    return SetVehicleParamsEx(vehicleid, VehParams[0], VehParams[1], VehParams[2], VehParams[3], VehParams[4], VehParams[5], VehParams[6]);
}
Thanks for the feedback tho!


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]);
}
Usage:
pawn Код:
SetVehParams(GetPlayerVehicleID(playerid), Engine, VEHICLE_PARAMS_ON);
Turns the engine on.
Reply


Messages In This Thread
Help using enums - by [L3th4l] - 27.02.2011, 04:52
Re: Help using enums - by Antonio [G-RP] - 27.02.2011, 04:55
Re: Help using enums - by Backwardsman97 - 27.02.2011, 04:56
Respuesta: Help using enums - by TheChaoz - 27.02.2011, 05:09
Re: Help using enums - by [L3th4l] - 27.02.2011, 05:10

Forum Jump:


Users browsing this thread: 1 Guest(s)