Engine????
#1

Hi guys I make this cmd but its not turn off engine what wrong or how to do this function..

pawn Код:
CMD:engine(playerid,params[])
{
    #pragma unused params
    if(IsPlayerConnected(playerid))
    {
        if(GetPlayerState(playerid) == 2)
        {
        new veh = GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
            if(VehicleInfo[veh][vEngine] == 0)
            {
                SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                SendClientMessage(playerid,GROVE,"Vehicle Engine OFF.");
                VehicleInfo[veh][vEngine] = 1; }
                else {
                     SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                     SendClientMessage(playerid,GROVE,"Vehicle Engine ON.");
                      VehicleInfo[veh][vEngine] = 0;
                    }
            }
        }
    return 1;
}
Reply
#2

Don't forget the unset param (-1).
Код:
#define VEHICLE_PARAMS_UNSET	-1
#define VEHICLE_PARAMS_OFF		0
#define VEHICLE_PARAMS_ON		1
I think if -1 or 1 then VehicleInfo[veh][vEngine] = 0 (off)
If 0, then VehicleInfo[veh][vEngine] = 1 (on)
Reply
#3

Quote:
Originally Posted by Rac3r
Посмотреть сообщение
Don't forget the unset param (-1).
Код:
#define VEHICLE_PARAMS_UNSET	-1
#define VEHICLE_PARAMS_OFF		0
#define VEHICLE_PARAMS_ON		1
I think if -1 or 1 then VehicleInfo[veh][vEngine] = 0 (off)
If 0, then VehicleInfo[veh][vEngine] = 1 (on)
What is do VEHICLE_PARAMS_UNSET -1
Reply
#4

It means it hasn't been set.

By using logic, the engine would be ON by default. So -1 (unset) would actually be 1.
http://pastebin.com/dqRmzP02
Reply
#5

Код:
if(engine)
            {
                SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                SendClientMessage(playerid,GROVE,"Vehicle Engine OFF.");
                VehicleInfo[veh][vEngine] = 1; }
                else {
                     SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
                     SendClientMessage(playerid,GROVE,"Vehicle Engine ON.");
                      VehicleInfo[veh][vEngine] = 0;
                    }
            }
Reply
#6

Ok its done But I want to do on gamemodeint that engine will off so I do this..

pawn Код:
stock LoadVehicles()
{
    new file[128];
    for(new i = 0;i < MAX_VEHICLES;i++)
    {
    format(file,sizeof(file),VEH_FILE,i);
    VehicleInfo[i][vModel] = dini_Int(file,"Model");
    VehicleInfo[i][vposX] = dini_Float(file,"PosX");
    VehicleInfo[i][vposY] = dini_Float(file,"PosY");
    VehicleInfo[i][vposZ] = dini_Float(file,"PosZ");
    VehicleInfo[i][vAngle] = dini_Float(file,"Angle");
    VehicleInfo[i][vLoaded] = dini_Int(file,"Load");
    VehicleInfo[i][vColor1] = dini_Int(file,"Color1");
    VehicleInfo[i][vColor2] = dini_Int(file,"Color2");
    SetVehicleParamsEx(i,0,0,0,0,0,0,0);//here I set all to 0
    }
    return 1;
}
But its not turning off the engine....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)