Command that puts nitro on a car
#1

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
Reply
#2

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

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;
}
Reply
#4

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;
}
Reply
#5

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..
Reply
#6

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.
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)