Nitro - 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: Nitro (
/showthread.php?tid=412670)
Nitro -
NickHaudMTA - 02.02.2013
i was looking for this,but i couldn't find it here.
When player holding KEY_FIRE nitro have to be on,but when stop holding KEY_FIRE nitro stops.
I really,really need that!!
Please if someone can help me with?
Thanks in advance.
Re: Nitro -
SKAzini - 02.02.2013
Idk if there's a function for this but make a timer and each 100ms or something check if player holds KEY_FIRE, if not, remove nitro..
Re: Nitro -
NickHaudMTA - 03.02.2013
Thanks works greate now.
Re: Nitro -
SiDiCeR - 03.02.2013
i have this:
pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
// Nitro
forward Nitro(playerid);
new NitroTimer;
public Nitro(playerid)
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_FIRE) || PRESSED(KEY_ACTION)) // CTRL/LMB Pressed
{
if (IsPlayerInAnyVehicle(playerid))
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
NitroTimer = SetTimerEx("Nitro", 2500, true, "d", playerid);
}
}
if (RELEASED(KEY_FIRE) || RELEASED(KEY_ACTION)) // CTRL/LMB Released
{
if (IsPlayerInAnyVehicle(playerid))
{
RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
KillTimer(NitroTimer);
}
}
return 1;
}