PDA

View Full Version : Command that puts nitro on a car


cowmilker69
17/07/2013, 11:16 PM
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

PabuLetz
18/07/2013, 12:00 AM
http://forum.sa-mp.com/showthread.php?t=121412

Grooty
18/07/2013, 01:49 AM
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;
}

Calvingreen17
18/07/2013, 02:45 AM
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;
}

Elie1996
18/07/2013, 08:29 AM
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..

Grooty
18/07/2013, 02:02 PM
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.

Elie1996
18/07/2013, 06:04 PM
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:


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 :D