[FilterScript] Unlimited Nitro (Drift Edition)(Simple)
#1

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

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;
}
Reply
#3

nice script +rep
Reply
#4

This is pretty nice.
Reply
#5

Good job. I think i may use it
Reply
#6

Simple and useful, good job!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)