SA-MP Forums Archive
[FilterScript] HoldNos - Changes the way NOS works. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] HoldNos - Changes the way NOS works. (/showthread.php?tid=452081)



HoldNos - Changes the way NOS works. - RedFusion - 20.07.2013


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;
}



Re: HoldNos - Changes the way NOS works. - [UG]Daniel - 20.07.2013

simple but nice.
gj


Re: HoldNos - Changes the way NOS works. - Team_PRO - 20.07.2013

nice and simple


Re: HoldNos - Changes the way NOS works. - dEcooR - 20.07.2013

true nice and simple


Re: HoldNos - Changes the way NOS works. - JaKe Elite - 20.07.2013

It would be better if SA-MP allowed the NOS Meter or something like a nitros meter and when player don't use nitro, the left nitro will be later used when player use the nitro again until it become empty making it non-usable, It'll be later usable when player earn some drift points and receive some nitros.

Oopps sorry i go offtopic right?

Anyway, Nice script


Re: HoldNos - Changes the way NOS works. - TDM - 20.07.2013

nice work...


Re: HoldNos - Changes the way NOS works. - EV007 - 20.07.2013

Quote:
Originally Posted by _Jake_
Посмотреть сообщение
It would be better if SA-MP allowed the NOS Meter or something like a nitros meter and when player don't use nitro, the left nitro will be later used when player use the nitro again until it become empty making it non-usable, It'll be later usable when player earn some drift points and receive some nitros.

Oopps sorry i go offtopic right?

Anyway, Nice script
Easily scriptable.

Ontopic: There are at least 10scripts like this for nitro usage.