SA-MP Forums Archive
Command that puts nitro on a car - 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)
+--- Thread: Command that puts nitro on a car (/showthread.php?tid=451627)



Command that puts nitro on a car - cowmilker69 - 17.07.2013

Hey wassup i was wondering if one would tell me how to make a script that puts nitro in any players car when he types /nitro
Thx in advance


Re: Command that puts nitro on a car - PabuLetz - 18.07.2013

https://sampforum.blast.hk/showthread.php?tid=121412


Re: Command that puts nitro on a car - Grooty - 18.07.2013

Add this to your script
Make sure you're using zCMD.
Код:
CMD:nitro(playerid, params[])
{
	new vehicle;
	vehicle = GetPlayerVehicleID(playerid);
	if(vehicle > 0)
	{
		AddVehicleComponent(vehicle, 1010);
	}
	else SendClientMessage(playerid,0xFF0000FF,"You are not in a vehicle!");
	return 1;
}



Re: Command that puts nitro on a car - Calvingreen17 - 18.07.2013

Aint it:

CMD:nitro(playerid,params[])
{
if(!IsPlayerInAnyVehicle(playerid))
{
new vehicle;
vehicle = GetPlayerVehiceID(playerid);
AddVehicleComponent(vehicle,1010);
SendClientMessage(playerid,COLOR_WHITE,"Nitros added");
}
else
{
SendClientMessage(playerid,COLOR_RED,"ERROR:You're not in a vehice");
}
return 1;
}


Re: Command that puts nitro on a car - Elie1996 - 18.07.2013

Quote:
Originally Posted by Calvingreen17
Посмотреть сообщение
Aint it:

CMD:nitro(playerid,params[])
{
if(!IsPlayerInAnyVehicle(playerid))
{
new vehicle;
vehicle = GetPlayerVehiceID(playerid);
AddVehicleComponent(vehicle,1010);
SendClientMessage(playerid,COLOR_WHITE,"Nitros added");
}
else
{
SendClientMessage(playerid,COLOR_RED,"ERROR:You're not in a vehice");
}
return 1;
}
hmm, both work I guess, there is no vehicle ID that is 0 or less, so yeah..


Re: Command that puts nitro on a car - Grooty - 18.07.2013

Quote:
Originally Posted by Elie1996
Посмотреть сообщение
hmm, both work I guess, there is no vehicle ID that is 0 or less, so yeah..
But if it's vehicle > 0, that means they aren't in a car.
Then it will send the message.


Re: Command that puts nitro on a car - Elie1996 - 18.07.2013

Quote:
Originally Posted by Grooty
Посмотреть сообщение
But if it's vehicle > 0, that means they aren't in a car.
Then it will send the message.
Wrong, if the vehicle ID is above 0, then the player is in Some car, you don't know which car it is, you just know its ID is above 0.
for example, let's say a player is an infernus:

pawn Код:
CMD:nitro(playerid, params[])
{
    new vehicle; // Vehicle ID Will be saved here
    vehicle = GetPlayerVehicleID(playerid); // vehicle = 411 (Infernus ID)
    if(vehicle > 0) // if(411 > 0) --> Returns True
    { // then
        AddVehicleComponent(vehicle, 1010); // Gives nitrous
    }
    else SendClientMessage(playerid,0xFF0000FF,"You are not in a vehicle!");
    return 1;
}
Easy