Car engine problem.
#1

Hello, how can i remove the "engine failed to start" from this CMD?

pawn Код:
CMD:car(playerid, params[])
{
    new rand = random(2);
    if(isnull(params))
    {
        SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /car [name]");
        SendClientMessageEx(playerid, COLOR_GREY, "Available names: Status, Engine, Lights, Trunk, Hood, Fuel");
        return 1;
    }
    if(strcmp(params, "engine", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
        new string[128];
        vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine == VEHICLE_PARAMS_ON)
        {
            SetVehicleEngine(vehicleid, playerid);
        }
        else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
        {
/*          SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
            SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);*/

           if(rand == 0)
           {
               SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
               SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine started");
               format(string, sizeof(string), "* %s has started his vehicle's engine",  GetPlayerNameEx(playerid));
               ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
           }
           if(rand == 1)
           {
               SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine failed to start");
               format(string, sizeof(string), "* %s struggles to start the engine but fails",  GetPlayerNameEx(playerid));
               ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
           }
        }
    }
Reply
#2

According to this command when rand turns 1 the vehicle engine fail to start, so take this off the command.

pawn Код:
if(rand == 1)
{
    SendClientMessage(playerid, COLOR_TWYELLOW, "Vehicle engine failed to start");
    format(string, sizeof(string), "* %s struggles to start the engine but fails",  GetPlayerNameEx(playerid));
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
Reply
#3

Working. Thanks. REPed...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)