SA-MP Forums Archive
All Vehicles Spawner Menu - 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: All Vehicles Spawner Menu (/showthread.php?tid=339390)



All Vehicles Spawner Menu - maxrobon1_police - 03.05.2012

Hi, i am making an object editor, i need ur help, i need a special filterscript for spawn vehicles, i can spawn vehicles and i save it in variable, but how i can obtain the ID for remove vehicles spawned or for remove all vehicles spawned??.. thanks


Re: All Vehicles Spawner Menu - Jonny5 - 03.05.2012

the variable you save it in is the ID of the vehicle.


Re: All Vehicles Spawner Menu - maxrobon1_police - 03.05.2012

ok, my code:

Quote:

enum VEHICLEDATA(){
Text3D:v3dtext,
id
}

new Veh[150][VEHICLEDATA];

stock CreateVehFromList(listitem, playerid)
{
new Float: x, Float: y, Float:z;
GetPlayerPos(playerid, x, y, z);

new vid = CreateVehicle(listitem+400,x+1.2,y+1.2,z,0,-1,-1,600000);

LinkVehicleToInterior(vid,GetPlayerInterior(player id));

new text[64];
format(text,sizeof(text),"[%d] %s spawned !", listitem+400,VehicleName[listitem]);
SendClientMessage(playerid, COLOR_MAGENTA, text);

Veh[vid][id] = vid;
new str[256];
format(str, sizeof(str), "[VEHICLE] \nModel: %i \nVehicleID: %i", GetVehicleModel(vid),Veh[vid][id]);
Veh[vid][v3dtext] = Create3DTextLabel(str,0xFF0000FF,0.0,0.0,0.0,50.0,-1,1);
Attach3DTextLabelToVehicle(Veh[vid][v3dtext],vid,0.0,0.0,0.5);
}

can u say me if is it good?


but for remove all cars created or remove by id no work:

Quote:

stock RemoveVeh(inputtext[])
{
new playerid;

if (strval(inputtext) != 0 )
{
DestroyVehicle(strval(inputtext));
}
else
{
for(new i = 0; i < 150; i++)
{
DestroyVehicle(i);
}
}
}

in InputText you type 0 if u want delete all or an id...
thanks..