DestroyVehlicle Help
#1

Hello guys. I try to make a /destroyvehicle command who destroy the vehicleid i mean if the car is id 3 when i type /destroyvehicle 3 the car get destroyed. I tried many times to construct the command but i get failed all times. Please help.
Reply
#2

Post here the command you made to create the cars and to destroy them.
Reply
#3

I think you cant destroy any vehicle that created by using AddStaticVehicle, except you create the vehicle using Createvehicle, and have defined it
Reply
#4

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp(cmdtext, "/destroyveh", true) == 0)
     {
          new currentveh;
          currentveh = GetPlayerVehicleID(playerid);
          DestroyVehicle(currentveh);
          return 1;
     }
 
     return 0;
}
That should be it i guess.
P.S: Could you kindly post whatever you have made so that i can help ?
Reply
#5

Nah ran, he wants to destroy a vehicle that is assigned by a var inside a command for a player.

if he post the command to create/destroy that he have made, would help.
Reply
#6

what happens when you type the command ingame? do you get any error message? I don't know but this:
Код:
if(strcmp(cmdtext, "/destroyveh", true) == 0)
should might be:
Код:
if(!strcmp(cmdtext, "/destroyveh", true))
instead, don't know if that's the problem tho.
Reply
#7

its same dude, ! is same with == 0
Reply
#8

Код:
if (strcmp("/elegy", cmdtext, true, 10) == 0)
	{
	if(IsPlayerInAnyVehicle(playerid))  return SendClientMessage(playerid, COLOR_RED, "ERROR: You already have a car.");
	new Float:X, Float:Y, Float:Z, elegy;
	GetPlayerPos(playerid, X, Y, Z);
	elegy = CreateVehicle(562, X, Y, Z, 0.0, 0, 0, 0);
	PutPlayerInVehicle(playerid, elegy, 0);
	return 1;
	}
That's the command for the car. I said i need a command to destroy vehicleid like /destroyvehicle (id)
Reply
#9

Nevermind i created it already. Thanks anyways. +rep
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)