Vehicle System Halp
#6

Forgot to tell you, If you put it on top of the GM / FS.
Delete it from other callbacks, as OnPlayerCommandText.

EDIT:
Try this:
pawn Код:
#include <a_samp>
#include <zcmd>

#define VEHICLE_PARAMS_UNSET    -1
#define VEHICLE_PARAMS_OFF  0
#define VEHICLE_PARAMS_ON   1
#define vehicleid GetPlayerVehicleID(playerid);

new EngineStatus[MAX_PLAYERS], LightsStatus[MAX_PLAYERS], AlarmStatus[MAX_PLAYERS], DoorsStatus[MAX_PLAYERS], BonnetStatus[MAX_PLAYERS], BootStatus[MAX_PLAYERS], ObjectiveStatus[MAX_PLAYERS];

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Vehicle Control System Loaded");
    print(" Coded by Auxxx");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    print("\n--------------------------------------");
    print(" Vehicle Control System Un-Loaded");
    print(" Coded by Auxxx");
    print("--------------------------------------\n");
    return 1;
}

CMD:veh(playerid, params[])
{
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new veh = GetPlayerVehicleID(playerid);
    if(strcmp(params, "Engine", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(veh != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[playerid] == 0)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {2F991A}on!");
                }
                else if(EngineStatus[playerid] == 1)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {E31919}off!");
                }
            }
        }
        else {
        SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
        }
    }
    else if(strcmp(params, "Lights", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(veh != INVALID_VEHICLE_ID)
            {
                if(LightsStatus[playerid] == 0)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    LightsStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's lights {2F991A}on!");
                }
                else if(LightsStatus[playerid] == 1)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    LightsStatus[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's lights {E31919}off!");
                }
            }
        }
        else {
        SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
        }
    }
    else if(strcmp(params, "Alarm", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(veh != INVALID_VEHICLE_ID)
            {
                if(AlarmStatus[playerid] == 0)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    AlarmStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's alarm {2F991A}on!");
                }
                else if(AlarmStatus[playerid] == 1)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    AlarmStatus[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's alarm {E31919}off!");
                }
            }
        }
        else {
        SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
        }
    }
    else if(strcmp(params, "Doors", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(veh != INVALID_VEHICLE_ID)
            {
                if(DoorsStatus[playerid] == 0)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    DoorsStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's doors are now {2F991A}open!");
                }
                else if(DoorsStatus[playerid] == 1)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    DoorsStatus[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's doors are now {E31919}closed!");
                }
            }
        }
        else {
        SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
        }
    }
    else if(strcmp(params, "Bonnet", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(veh != INVALID_VEHICLE_ID)
            {
                if(BonnetStatus[playerid] == 0)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    BonnetStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's bonnet is now {2F991A}open!");
                }
                else if(BonnetStatus[playerid] == 1)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    BonnetStatus[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's bonnet is now {E31919}closed!");
                }
            }
        }
        else {
        SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
        }
    }
    else if(strcmp(params, "Boot", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(veh != INVALID_VEHICLE_ID)
            {
                if(BootStatus[playerid] == 0)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    BootStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's boot is now {2F991A}open!");
                }
                else if(BootStatus[playerid] == 1)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    BootStatus[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's boot is now {E31919}closed!");
                }
            }
        }
        else {
        SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
        }
    }
    else if(strcmp(params, "Objective", true) == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(veh != INVALID_VEHICLE_ID)
            {
                if(ObjectiveStatus[playerid] == 0)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    ObjectiveStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's objective is now {2F991A}active!");
                }
                else if(ObjectiveStatus[playerid] == 1)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    ObjectiveStatus[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's objective is now {E31919}unactive!");
                }
            }
        }
        else {
        SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
        }
    }
    else SendClientMessage(playerid, 0xFFFFFFAA, "SYNTAX: /veh [function]"),
    SendClientMessage(playerid, 0xFFFFFFAA, "Functions: Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective");
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_LOOK_BEHIND))
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            if(veh != INVALID_VEHICLE_ID)
            {
                if(EngineStatus[playerid] == 0)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[playerid] = 1;
                    SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {2F991A}on!");
                }
                else if(EngineStatus[playerid] == 1)
                {
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
                    EngineStatus[playerid] = 0;
                    SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {E31919}off!");
                }
            }
        }
        else {
        SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
        }
    }
    return 1;
}
Reply


Messages In This Thread
Vehicle System Halp - by franciskyle09 - 30.12.2010, 15:14
Re: Vehicle System Halp - by XePloiT - 30.12.2010, 15:50
Re: Vehicle System Halp - by franciskyle09 - 30.12.2010, 15:56
Re: Vehicle System Halp - by Toreno - 30.12.2010, 16:04
Re: Vehicle System Halp - by franciskyle09 - 30.12.2010, 16:09
Re: Vehicle System Halp - by Toreno - 30.12.2010, 16:14
Re: Vehicle System Halp - by franciskyle09 - 30.12.2010, 16:36
Re: Vehicle System Halp - by thimo - 30.12.2010, 16:55
Re: Vehicle System Halp - by franciskyle09 - 30.12.2010, 17:00
Re: Vehicle System Halp - by MadeMan - 30.12.2010, 17:31

Forum Jump:


Users browsing this thread: 1 Guest(s)