[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
#2

simple but nice.
gj
Reply
#3

nice and simple
Reply
#4

true nice and simple
Reply
#5

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
Reply
#6

nice work...
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)