SA-MP Forums Archive
Help with my nitro button/command - 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: Help with my nitro button/command (/showthread.php?tid=155943)



Help with my nitro button/command - Jay. - 20.06.2010

I've made a command with OnPlayerKeyStateChange.

Off nitro.

But theres a big problem, When the player presses the button on a bike they crash.


Is there away to block some vehicle ids?


Heres my code



Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerInAnyVehicle(playerid))
{

if(newkeys & KEY_FIRE)
{
	
	if(IsPlayerInAnyVehicle(playerid))
	AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); 
}
return 1;
}
}


Re: Help with my nitro button/command - Jay. - 20.06.2010

Sorry for the bump, But this must be simple.


Re: Help with my nitro button/command - Joe_ - 20.06.2010

Use an ARRAY.

pawn Код:
new BadVehicles[] =
{
400, 401, 402 // Place the ## MODEL ## Id's like I did here.
};

//Under your nos command

for(new a = 0; a < sizeof(BadVehicles); a++)
{
new model = GetVehicleModel(vehicleid);
if(model != BadVehicles[a])
{
//Do your nitro
}
SendClientMessage(playerid, COLOR, "Gtfo cr44shing my s3rv00r n33b!!111!11");
}



Re: Help with my nitro button/command - Hiddos - 20.06.2010

Check if the vehicle model isn't a bike model.

if(GetVehicleModelID(GetPlayerVehicleID(playerid) != bike id)

Didn't YSI had a IsPlayerInBike function?


Re: Help with my nitro button/command - Jay. - 20.06.2010

Thanks guyz.


Re: Help with my nitro button/command - Joe_ - 20.06.2010

I prefer Arrays/varibles to Functions, and using

if(model == bike || model == ..)

Is just crap and extremely static, it would be annoying editing it, so an array is much more convinient.


Re: Help with my nitro button/command - Jay. - 20.06.2010

Quote:
Originally Posted by Joe_
I prefer Arrays/varibles to Functions, and using

if(model == bike || model == ..)

Is just crap and extremely static, it would be annoying editing it, so an array is much more convinient.
I used your code btw joe.


Thanks