[HELP]DestroyVehicle
#1

Hi guys,
can you help me with problem with DestroyVehicle ?

First:
I create my admin car.
Код:
new AdminVozidlo;
dcmd_ac(playerid, params[])
#pragma unused params
{
    if(IsPlayerAdmin(playerid))
    {
   	new Float:X,Float:Y,Float:Z,Float:angle;
	GetPlayerPos(playerid,X,Y,Z);
	AdminVozidlo = CreateVehicle(411,X,Y,Z,angle,0,0,-1);
	PutPlayerInVehicle(playerid, AdminVozidlo, 0);
	}else{ // you are not administrator... etc etc....
	return 1;
}
All is right.
But if i create more cars (2, 3, 4, 5....), and i destroycars with
Код:
dcmd_acd(playerid, params[])
#pragma unused params
{
    if(IsPlayerAdmin(playerid))
    {
    DestroyVehicle(AdminVozidlo);
    }else{ // you are not admin etc, etc....
    }
	return 1;
}
I destroy only last one car.
Can you help me with destroy all created cars ?
Thank you, good day
Reply
#2

Every vehicle gets assigned the same varible, so its going to delete the last one,

You need to create a varible like

new AdminVozidlo[10];

Then in your command make it so you can do

/ac (car id number 1 - 10)

then under

/acd

do DestroyVehicle(AdminVozidlo[id]);
Reply
#3

KyleSmith: Thank you for answer.
And how do command /ac ?
Or can you do command /ac ?
Reply
#4

I havn't got time to help you at the moment. Il come back to you, Maybe someone else might in the mean time. Sorry.
Reply
#5

KyleSmith: Ok thank, i will waiting
Reply
#6

Can you help me Anyone ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)