Two errors with bikes
#1

My first error is that bikes such as the BMX require you to start the engine in order to drive it. However, in the code below, as far as I understand, it should exempt the bikes from requiring the /engine command.

Код:
if(strcmp(cmd,"/engine",true) == 0)
        {
            new engine,lights,alarm,doors,bonnet,boot,objective;
            new vehid = GetPlayerVehicleID(playerid);
            if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
                {
                    if(vehid == 481 || vehid == 509 || vehid == 510)
                        return 1;
                    GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
                    if(engine<=0)
                    {
                GameTextForPlayer(playerid, "~g~Starting the engine...", 1200, 1);
                                SetTimerEx("StartEngine", 1500, 0, "ii", playerid, vehid);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Stopping the engine...", 1200, 1);
                                SetTimerEx("StopEngine", 1500, 0, "ii", playerid, vehid);
                        }
                }
        }
My second error is that I want four bicycles to spawn but only one spawns.

Код:
// Bicycles
    AddStaticVehicleEx ( 509, 1687.2222, -2294.1111, 13.5555, 90, 0, 0, 300 );
    AddStaticVehicleEx ( 509, 1687.2222, -3004.1111, 13.5555, 90, 1, 1, 300 );
    AddStaticVehicleEx ( 509, 1687.2222, -3014.1111, 13.5555, 90, 2, 2, 300 );
    AddStaticVehicleEx ( 509, 1687.2222, -3024.1111, 13.5555, 90, 3, 3, 300 );
    AddStaticVehicleEx ( 509, 1687.2222, -3034.1111, 13.5555, 90, 4, 4, 300 );
        return 1;
}
Reply
#2

nope... your script says that the IDs 481 509 and 510 should be excluded, meaning vehicle number 481, 509 and 510 on the server...
to exclude bikes you need to get the model, like that:
Код:
if(strcmp(cmd,"/engine",true) == 0)
        {
            new engine,lights,alarm,doors,bonnet,boot,objective;
            new vehid = GetPlayerVehicleID(playerid);
            new model = GetVehicleModel(vehid);
            if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER)
                {
                    if(model == 481 || model == 509 || model == 510)
                        return 1;
                    GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
                    if(engine<=0)
                    {
                GameTextForPlayer(playerid, "~g~Starting the engine...", 1200, 1);
                                SetTimerEx("StartEngine", 1500, 0, "ii", playerid, vehid);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Stopping the engine...", 1200, 1);
                                SetTimerEx("StopEngine", 1500, 0, "ii", playerid, vehid);
                        }
                }
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)