SA-MP Forums Archive
How to! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to! (/showthread.php?tid=136342)



How to! - ColdXX - 24.03.2010

How can i make a command like for example when i press left mouse button to give the car nitrous...or when i press other key to fix my car?!
I saw that its possible so if anyone can help me please do it :P
Thanks!


Re: How to! - Drake1994 - 24.03.2010

this is the nitro:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (PRESSED(KEY_FIRE)) //NITRO
	{
		new
		car = GetPlayerVehicleID(playerid);
		if (vehicleid)
		{
			AddVehicleComponent(car, 1010);
		}
	}
// CAR FIX
    if (PRESSED(KEY_CROUCH))
	{
		RepairVehicle(GetPlayerVehicleID(playerid));
      	SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
      	PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
        else
  	    {
    	SendClientMessage(playerid, COLOR_RED, "Nem vagy jбrműben..");
  	    }
	}
	return 1;
}



Re: How to! - Joe Staff - 24.03.2010

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
{
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
SendClientMessage(playerid,0xFF0000FF,"Nitrox10 added!");
}
return 1;
}


Re: How to! - ColdXX - 24.03.2010

Thanks!