[Tutorial] ADD fire from exhaust when player use 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)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] ADD fire from exhaust when player use nitro! (
/showthread.php?tid=427456)
Create fire from exhaust when player use nitro! -
brawrr - 01.04.2013
PHP Code:
new CarFireObj[MAX_PLAYERS]; // Under the script
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (HOLDING( 4 ))// if player use nitro
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsValidObject(CarFireObj[playerid]) == 0)// add fire from exhaust when player use nitro
{
CarFireObj[playerid] = CreateObject(18694, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(CarFireObj[playerid], GetPlayerVehicleID(playerid), 0.0, -2.3, 1.2, 180.0, 0.0, 0.0);
}
}
}
if (RELEASED( 4 ))// if player stop use nitro
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsValidObject(CarFireObj[playerid]) == 1)DestroyObject(CarFireObj[playerid]);// remove fire from exhaust when player stop use nitro
}
}
return 1;
}
Re: ADD fire from exhaust when player use nitro! -
davve95 - 01.04.2013
Awesome!, and cool idea!, but wrong place to post its not a tutorial, it's when you explain how to do etc.
Post cin filterscript section next time!.
Re: Create fire from exhaust when player use nitro! -
Luminar - 28.09.2013
Quote:
Originally Posted by brawrr
PHP Code:
new CarFireObj[MAX_PLAYERS]; // Under the script
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (HOLDING( 4 ))// if player use nitro
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsValidObject(CarFireObj[playerid]) == 0)// add fire from exhaust when player use nitro
{
CarFireObj[playerid] = CreateObject(18694, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(CarFireObj[playerid], GetPlayerVehicleID(playerid), 0.0, -2.3, 1.2, 180.0, 0.0, 0.0);
}
}
}
if (RELEASED( 4 ))// if player stop use nitro
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsValidObject(CarFireObj[playerid]) == 1)DestroyObject(CarFireObj[playerid]);// remove fire from exhaust when player stop use nitro
}
}
return 1;
}
|
I cant put in in my server......