I made simple dialog for vehicle spawn.It works but I want to destroy vehicle when player leave it.I made something and destroy vehicle on exit but only for 1 player,if 2 players spawn vehicle at same time,it will destroy it only for first player.
here is the code..
Код:
case DIALOG_VEHICLESPAWN:
{
if(response)
{
new Float:Pos[4];
switch(listitem)
{
case 0:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(411, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 1:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(541, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 2:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(451, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 3:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(506, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 4:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(603, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 5:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(502, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 6:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(560, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 7:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(495, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 8:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(557, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 9:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(522, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 10:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(452, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
case 11:
{
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
spawnvehicle = CreateVehicle(487, Pos[0], Pos[1], Pos[2], Pos[3], 0, 0, -1);
PutPlayerInVehicle(playerid, spawnvehicle, 0);
}
}
}
}
sorry fo bad copy of the script lines.