[Question] How to get rid of spawned vehicles
#1

hey its me once more again! lol

i was just wondering if theres a command where you can get rid of all the spawned vehicles in the server since its rly annoying when u just have cars and crap lying around .. especially at the race starts .. oohh so many of them.

thanks, Bryce
Reply
#2

i really dont no aye
Reply
#3

i dont no its hard
Reply
#4

Quote:
Originally Posted by bobby4life
i dont no its hard
dude.. its not an IRC channel do NOT spam here!



and for your request:

you can use

GetPlayerVehicleID(playerid);

IsPlayerInAnyVehicle(playerid);

DestroyVehicle(VEHICLEID);
Reply
#5

yeh im kinda nooby so i dno waht rly to do here...

if i use this does it mean that it will only destroy the vehicle if someones in it?
Reply
#6

try using those:
pawn Код:
if(strcmp(cmd, "/vehid", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new strid = GetPlayerVehicleID(playerid);
            format(string, sizeof(string), "Vehicle ID: %d",strid);
            SendClientMessage(playerid, COLOR_WHITE, string);
        }
        return 1;
    }

--> THIS WILL GET YOU THE ID OF THE VEHICLE YOU ARE SITTING IN RIGHT NOW.

pawn Код:
if(strcmp(cmd, "/reloadvehicles", true) == 0)
    {
      if(IsPlayerConnected(playerid))
        {
            for(new i = 0; i < MAX_VEHICLES; i++)
            {
                if(IsVehicleOccupied(i) == 0)
                {
                SetVehicleToRespawn(i);
              }
            }
            SendClientMessage(playerid, COLOR_RED, "* All vehicles have been reloaded.");
        }
        return 1;
    }

--> THIS ONE TO RELOAD (ALL) OF YOUR VEHICLES ON YOU GAMESERVER.

pawn Код:
[url=http://wiki.sa-mp.com/wiki/DestroyVehicle]https://sampwiki.blast.hk/wiki/DestroyVehicle[/url]
Reply
#7

Quote:
Originally Posted by FujiNNN
pawn Код:
[url=http://wiki.sa-mp.com/wiki/DestroyVehicle]https://sampwiki.blast.hk/wiki/DestroyVehicle[/url]
Fail lol

https://sampwiki.blast.hk/wiki/DestroyVehicle
Reply
#8

on the second one i get an error message saying,

"error 017: undefined symbol "IsVehicleOccupied""

so thats a bit of a doosie
Reply
#9

hey i just had an idea! lol

mabe i could use 'onplayerexitvehicle' so when the player exits the vehicle it gets destroyed?? is there a way to do that?
Reply
#10

oh sweet i made my own script! lol its pretty simple though

i just put this under "onplayerexitveh"

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
  new currentveh;
  currentveh = GetPlayerVehicleID(playerid);
  DestroyVehicle(currentveh);
	return 1;
}
thanks for the help FujiNNN!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)