[FilterScript] HoldNos - Changes the way NOS works.
#1


This script replaces the NOS canister continuously (if there is one installed) in your vehicle while you hold the nos activation button.
It starts when you press the nos button and stops when you release it.

[ame]http://www.youtube.com/watch?v=kBiuQBubfBI&[/ame]
pawn Код:
#include <a_samp>
new NosTimer[MAX_PLAYERS];

public OnFilterScriptInit()
{
    print("HoldNos Loaded");
    return 1;
}

public OnFilterScriptExit()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++) KillTimer(NosTimer[playerid]);
    return 1;
}

public OnPlayerDisconnect(playerid) KillTimer(NosTimer[playerid]);
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_DRIVER) KillTimer(NosTimer[playerid]);
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicleid, nos;
        vehicleid = GetPlayerVehicleID(playerid);
        nos = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_NITRO);
        if(nos == 0) return 1;

        if( ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) || ((newkeys & KEY_ACTION) && !(oldkeys & KEY_ACTION)) ) //Press
        {
            KillTimer(NosTimer[playerid]);
            NosTimer[playerid] = SetTimerEx("UpdatePlayerNos", 2000, true, "i", playerid);
        }
        if( ((oldkeys & KEY_FIRE) && !(newkeys & KEY_FIRE)) || ((oldkeys & KEY_ACTION) && !(newkeys & KEY_ACTION)) ) //Release
        {
            RemoveVehicleComponent(vehicleid, nos);
            AddVehicleComponent(vehicleid, nos);
            KillTimer(NosTimer[playerid]);
        }
    }
    return 1;
}

forward UpdatePlayerNos(playerid);
public UpdatePlayerNos(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicleid, nos;
        vehicleid = GetPlayerVehicleID(playerid);
        nos = GetVehicleComponentInSlot(vehicleid, CARMODTYPE_NITRO);
        if(nos == 0) return 1;

        AddVehicleComponent(vehicleid, nos);
    }
    return 1;
}
Reply


Messages In This Thread
HoldNos - Changes the way NOS works. - by RedFusion - 20.07.2013, 00:55
Re: HoldNos - Changes the way NOS works. - by [UG]Daniel - 20.07.2013, 01:02
Re: HoldNos - Changes the way NOS works. - by Team_PRO - 20.07.2013, 07:56
Re: HoldNos - Changes the way NOS works. - by dEcooR - 20.07.2013, 08:51
Re: HoldNos - Changes the way NOS works. - by JaKe Elite - 20.07.2013, 09:07
Re: HoldNos - Changes the way NOS works. - by TDM - 20.07.2013, 11:14
Re: HoldNos - Changes the way NOS works. - by EV007 - 20.07.2013, 20:52

Forum Jump:


Users browsing this thread: 1 Guest(s)