[Solved] AddVehicleComponent problem or something
#1

Well i work on these AddVehicleComponent thingy and all i got this

Код:
	new vehicle;
	if (strcmp("/nitro", cmdtext, true, 10) == 0)
	{
		AddVehicleComponent(vehicle,1010);
		SendClientMessage(playerid,0xFF9900AA,"Your Car Has Nitro Now");
		return 1;
	}
so when player type /nitro his car gets nitro but when i tested it just says "your car has nitro now" and the nitro doesnt appear=/
another thing if theres a tutorial for like "You need to be in a car to use this command!" to check if player is in vehicle (i know the CheckIfPlayerOnVehicle or something like that) but to know how to put it all together thanks.
Reply
#2

'vehicle' has to be defined for it to work, you just made a variable and used it (default at 0). There's really no need for a variable anyway sense you can just use a function to retrieve a player's vehicle ID.

Try this:
pawn Код:
if (strcmp("/nitro", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0xFF0000FF,"You must be in a vehicle!"); //If the function 'IsPlayerInAnyVehicle' returns 0(false) then it will stop the command and send a message at the same time.
        AddVehicleComponent(GetPlayerVehicleID(playerid),1010); // no need for 'vehicle'
        SendClientMessage(playerid,0xFF9900AA,"Your Car Has Nitro Now");
        return 1;
    }
Reply
#3

Ok i get it know. thanks to you. thanks alot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)