SA-MP Forums Archive
[FilterScript] Unlimited Nitro (Drift Edition)(Simple) - 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] Unlimited Nitro (Drift Edition)(Simple) (/showthread.php?tid=365311)



Unlimited Nitro (Drift Edition)(Simple) - mrsamp - 02.08.2012

This is not really a full filterscript but you can add it to your gamemode.
This is my 1st Filterscript or Tutorial or w/e you'll call it.
I've searched for this but never really found anything like this. As Drifter is it good that nitro stops so you don't spin out.

Yes. I know you can make this very easy by looking at wiki.sa-mp.com but I decided to post it here.
Please don't hate.
Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
	(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))



public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(PRESSED(KEY_ACTION)) //KEY_ACTION can also be changed to KEY_FIRE wich is orginal LMB
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
		}
	}
	if(RELEASED(KEY_ACTION))
 	{
 	    if(IsPlayerInAnyVehicle(playerid))
 	    {
 	        RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
 	    }
 	}
	if(PRESSED(KEY_SUBMISSION))
	{
	new vehicleid = GetPlayerVehicleID(playerid);
	if(IsPlayerInVehicle(playerid, vehicleid))
 	{
		SetVehicleHealth(vehicleid,1000.0);
        RepairVehicle(GetPlayerVehicleID(playerid));
		PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
  	}
	}
	return 1;
}
If you don't like this ok I don't care.


Re: Unlimited Nitro (Drift Edition)(Simple) - Jessyy - 02.08.2012

This is a better version of your code ... To activate the nos, hold the ALT, CTRL, FIRE key ...
A couple of things you need.
---1. zcmd include by Zeex: https://sampforum.blast.hk/showthread.php?tid=91354
---2. foreach include by ******: https://sampforum.blast.hk/showthread.php?tid=92679
Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
#define RELEASED(%0) \
	(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))

new bool:nfsnos_mod[MAX_PLAYERS]= {false, ...};

public OnGameModeInit()
{
	SetTimer("NFSnos_time", 300, true);
	return 1;
}

public NFSnos_time()
{
	foreach(new i : Player) {
		if(nfsnos_mod[i] && GetPlayerState(i) == PLAYER_STATE_DRIVER) {
			AddVehicleComponent(GetPlayerVehicleID(i), 1010);
		}
	}
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(IsPlayerInAnyVehicle(playerid)) {
		if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && (PRESSED(KEY_ACTION) || RELEASED(KEY_ACTION) || PRESSED(KEY_FIRE) || RELEASED(KEY_FIRE))) {
			AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
		}
		if(PRESSED(KEY_SUBMISSION)) {
			RepairVehicle(GetPlayerVehicleID(playerid));
			SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
			PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
		}
	}
	return 1;
}

CMD:nfsnos(playerid, params[])
{
	if(nfsnos_mod[playerid]) {
		nfsnos_mod[playerid] = false;
		SendClientMessage(playerid, 0xFF0000FF, "NFS nos activated");
	}
	else {
		nfsnos_mod[playerid] = true;
		SendClientMessage(playerid, 0xFF0000FF, "NFS nos deactivated");
	}
	return 1;
}



Re: Unlimited Nitro (Drift Edition)(Simple) - DarkB0y - 02.08.2012

nice script +rep


Re: Unlimited Nitro (Drift Edition)(Simple) - AaronKillz - 02.08.2012

This is pretty nice.


Re: Unlimited Nitro (Drift Edition)(Simple) - xSkullx - 02.08.2012

Good job. I think i may use it


Re: Unlimited Nitro (Drift Edition)(Simple) - jpeg - 02.08.2012

Simple and useful, good job!