SA-MP Forums Archive
DestroyVehlicle Help - 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: DestroyVehlicle Help (/showthread.php?tid=369237)



DestroyVehlicle Help - necrobg3 - 16.08.2012

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.


Re: DestroyVehlicle Help - leonardo1434 - 16.08.2012

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


Re: DestroyVehlicle Help - IceMeteor - 16.08.2012

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


Re: DestroyVehlicle Help - RanSEE - 16.08.2012

Код:
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 ?


Re: DestroyVehlicle Help - leonardo1434 - 16.08.2012

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.


Re: DestroyVehlicle Help - Ranama - 16.08.2012

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.


Re: DestroyVehlicle Help - IceMeteor - 16.08.2012

its same dude, ! is same with == 0


Re: DestroyVehlicle Help - necrobg3 - 16.08.2012

Код:
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)


Re: DestroyVehlicle Help - necrobg3 - 16.08.2012

Nevermind i created it already. Thanks anyways. +rep