Engines wont start!
#1

Hello.

When someone types /engine the engine doesn't actually start!

please help!

pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
                {
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    if(gEngine[playerid] == 0)
                    {
                        SCM(playerid, COLOR_PINK, "Car engine started.");
                        new engine, lights, alarm, doors, bonnet, boot, objective;
                        GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
                        SetVehicleParamsEx(pveh, 1, lights, alarm, doors, bonnet, boot, objective);
                        gEngine[playerid] = 1;
                        engineOn[pveh] = 1;
                        format(string, sizeof(string), "%s starts the car's engine.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                    else if(gEngine[playerid] == 1)
                    {
                        SCM(playerid, COLOR_PINK, "Car engine stopped.");
                        new engine, lights, alarm, doors, bonnet, boot, objective;
                        GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
                        SetVehicleParamsEx(pveh, 0, lights, alarm, doors, bonnet, boot, objective);
                        gEngine[playerid] = 0;
                        engineOn[pveh] = 0;
                        format(string, sizeof(string), "%s stops the car's engine.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                }
                else
                {
                    SCM(playerid, COLOR_CREAM, "You cannot start the engine as passenger.");
                    return 1;
                }
            }
            else
            {
                SCM(playerid, COLOR_CREAM, "You are not in a vehicle.");
                return 1;
            }
        }
    }
Reply
#2

Then get a new engine, ha. ha. ha.
No honestly, this should fix it.
pawn Код:
if(strcmp(cmd, "/engine", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInAnyVehicle(playerid))
            {
                if(GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
                {
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    if(gEngine[playerid] != 1)
                    {
                        SCM(playerid, COLOR_PINK, "Car engine started.");
                        new engine, lights, alarm, doors, bonnet, boot, objective;
                        GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
                        SetVehicleParamsEx(pveh, 1, lights, alarm, doors, bonnet, boot, objective);
                        gEngine[playerid] = 1;
                        engineOn[pveh] = 1;
                        format(string, sizeof(string), "%s starts the car's engine.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                    else if(gEngine[playerid] == 1)
                    {
                        SCM(playerid, COLOR_PINK, "Car engine stopped.");
                        new engine, lights, alarm, doors, bonnet, boot, objective;
                        GetVehicleParamsEx(pveh, engine, lights, alarm, doors, bonnet, boot, objective);
                        SetVehicleParamsEx(pveh, 0, lights, alarm, doors, bonnet, boot, objective);
                        gEngine[playerid] = 0;
                        engineOn[pveh] = 0;
                        format(string, sizeof(string), "%s stops the car's engine.", sendername);
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        return 1;
                    }
                }
                else
                {
                    SCM(playerid, COLOR_CREAM, "You cannot start the engine as passenger.");
                    return 1;
                }
            }
            else
            {
                SCM(playerid, COLOR_CREAM, "You are not in a vehicle.");
                return 1;
            }
        }
    }
EDIT:
I would suggest storing the gEngine onto the vehicleid, instead of playerid.
Reply
#3

Sorry, its still not working
Reply
#4

Also.


pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new string[128];
    new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
    new vehicle = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid))
    {
        SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
        SetTimerEx("engine2", 2500, false, "i", playerid);
    }
    else if(newstate == PLAYER_STATE_DRIVER && (pveh != 509 && pveh != 481 && pveh != 510) && IsPlayerInAnyVehicle(playerid))
    {
        SetTimerEx("Startup", 1, false, "ii", playerid, vehicle);
        SetTimerEx("engine2", 2500, false, "i", playerid);
    }
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerWeapon(playerid) == 29)
        {
            SetPlayerArmedWeapon(playerid, 0);
        }
    }
That might help?
Reply
#5

Quote:
Originally Posted by Oscii
Посмотреть сообщение
Sorry, its still not working
No problem, what does it tell you when you use /engine?
Reply
#6

The engine just does not start. D:
Reply
#7

Any of the client messages appear?
Reply
#8

Yup.
Reply
#9

Change:
pawn Код:
SetVehicleParamsEx(pveh, 1, lights, alarm, doors, bonnet, boot, objective);
To
pawn Код:
SetVehicleParamsEx(pveh, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
Reply
#10

Damn

Still not working dude
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)