Unlimited NOS on LMB click? (Rep+) - 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: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Unlimited NOS on LMB click? (Rep+) (
/showthread.php?tid=311666)
Unlimited NOS on LMB click? (Rep+) -
JohnDoVaS12345 - 17.01.2012
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?
Re: Unlimited NOS on LMB click? (Rep+) -
Gerira Gaijin - 17.01.2012
It can be done, check this:
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange (it's under examples)
Re: Unlimited NOS on LMB click? (Rep+) -
MP2 - 17.01.2012
It's not possible to remove the 'expiration' of nos, if that's what you mean.
Re: Unlimited NOS on LMB click? (Rep+) -
Richie - 18.01.2012
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;
}
Re: Unlimited NOS on LMB click? (Rep+) -
2KY - 18.01.2012
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!
Re: Unlimited NOS on LMB click? (Rep+) -
d0nTtoucH - 04.08.2013
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
Re: Unlimited NOS on LMB click? (Rep+) -
hossa - 04.08.2013
press Alt or LMB as i remember.
Re: Unlimited NOS on LMB click? (Rep+) -
-Shifty- - 04.08.2013
It'll work absolutely fine while using the example from the SA-MP wiki.
Re: Unlimited NOS on LMB click? (Rep+) -
Jefff - 04.08.2013
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;
}