Whats wrong?
#1

Hi,!!
I have this filterscript for engine.In this filterscript with 2 i need to turn on the engine and again 2 to turn off but is not working :S
Can somebody help?

pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_PURPLE 0xC2A2DAAA




forward HEngine(playerid,vehicleid);
forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
forward ProxDetectorS(Float:radi, playerid, targetid);

new bool:EngineState[MAX_VEHICLES];
new Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective;

#if defined FILTERSCRIPT


public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Engine On Off System by Harish.M");
    print("--------------------------------------\n");
    print(" Engine On Off System Loaded....");
    for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
    {
   GetVehicleParamsEx(Vehicles, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
   SetVehicleParamsEx(Vehicles, VEHICLE_PARAMS_OFF, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
    }
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public HEngine(playerid,vehicleid)
{
    GetVehicleParamsEx(vehicleid, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
    if(EngineState[vehicleid]==false)
    {
        SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
        new pName[24];
        new string[128];
        GetPlayerName(playerid, pName, 24);
        format(string, 128, "|%s go vrti klucot.", pName);
        format(string, 128, "|%s go startuva motorot.", pName);
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        SendClientMessage(playerid, COLOR_WHITE,"Motorot e {33AA33}Startuvan!");
        EngineState[vehicleid] = true;
    }
    else
    {
        SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
        SendClientMessage(playerid, COLOR_WHITE,"Motorot e {AA3333}izgasen!");
        EngineState[vehicleid] = false;
    }
}
public OnPlayerConnect(playerid)
{
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}

public OnPlayerSpawn(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    GetVehicleParamsEx(vehicleid, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
    EngineState[vehicleid] = false;
    return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        // Do something here
        return 1;
    }
    return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!ispassenger)
    {
        SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
        EngineState[vehicleid] = false;
        SendClientMessage(playerid,0xFFFFFF,"Pretisnete 2 za da go {33AA33}startuvate{FFFFFF}/{AA3333}izgasite{FFFFFF} motorot");
    }
    return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 1;
}

public OnRconCommand(cmd[])
{
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    return 1;
}

public OnObjectMoved(objectid)
{
    return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
    return 1;
}

public OnPlayerExitedMenu(playerid)
{
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys == KEY_SUBMISSION)
    {
        new vehicleid;
        vehicleid = GetPlayerVehicleID(playerid);
        new playerState = GetPlayerState(playerid);
        if (playerState == PLAYER_STATE_DRIVER)
        {
            if(EngineState[vehicleid] == true)
            {
                new pName[24];
                new string[128];
                GetPlayerName(playerid, pName, 24);
                format(string, 128, "|%s go izgasi motorot.", pName);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                SetTimerEx("HEngine",1,0,"dd",playerid,vehicleid);
            }
            else
            {
                SetTimerEx("HEngine",1,0,"dd",playerid,vehicleid);
                EngineState[vehicleid] = false;
            }
        }
    }
    return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
    return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
    return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    return 1;
}

public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, string);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
return 1;
}
Reply
#2

try putting that in this, before checking new keys.

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)