Unlimited NOS on LMB click? (Rep+)
#1

ok can u help me telling me how i can have NOS on a car by pressing LMB? when i leave LMB i want NOS to stop. can it be?
Reply
#2

It can be done, check this: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange (it's under examples)
Reply
#3

It's not possible to remove the 'expiration' of nos, if that's what you mean.
Reply
#4

After it expire, addvehiclecomponent with nos again.
something like this;
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(newkeys & KEY_FIRE)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            AddVehicleComponent(vehicleid, 1010);
        }
    }
    return 1;
}
Reply
#5

You could try out 2K-NOS. Requires absolutely no effort on your end, and it's easy! It doesn't have 'unlimited' nos, but as stated above, it's not possible. I may end up rewriting it to use Velocity though, in which case 'unlimited nos' may very well be possible!
Reply
#6

Quote:
Originally Posted by Richie
Посмотреть сообщение
After it expire, addvehiclecomponent with nos again.
something like this;
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        if(newkeys & KEY_FIRE)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            AddVehicleComponent(vehicleid, 1010);
        }
    }
    return 1;
}
When i press CTRL nitro is not working ? why
Reply
#7

press Alt or LMB as i remember.
Reply
#8

It'll work absolutely fine while using the example from the SA-MP wiki.
Reply
#9

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new State = GetPlayerState(playerid);
    if(State == PLAYER_STATE_DRIVER)
    {
        new VehID = GetPlayerVehicleID(playerid);
        if(PRESSED(KEY_FIRE))
        {
            AddVehicleComponent(VehID, 1010);
            return 0;
        }

        if(RELEASED(KEY_FIRE))
        {

            if(VehID > 0 && VehID != INVALID_VEHICLE_ID)
            {
                new component = GetVehicleComponentInSlot(VehID, CARMODTYPE_NITRO);
                if(component == 1010)
                    RemoveVehicleComponent(VehID,1010);
            }

            return 0;
        }
        return 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)