Remove players from a specific vehicle

Started by Mötley, Dec 21, 2016, 05:39 PM

Previous topic - Next topic

Mötley

Well my server is setup to where if a player spawns a vehicle there last spawned vehicle is automatically removed.

I would to receive help on properly removing all players from that vehicle, Which means each seat, And hopefully no loop, And nothing that will alter data usage.



In the commands I added a simple array to store the vehicle.ID in, This array never gets cleared 'So far', Unless I plan to remove the vehicle on player part. So when the player spawns another vehicle that vehicle is automatically removed, Even if it belonged to another player 'Same array value, player.ID etc etc..

   
    if (Added_Vehicle[player.ID] > 0)
    {
        local vehicle = FindVehicle(Added_Vehicle[player.ID]);
        if (vehicle)
        {
            vehicle.Remove();
        }
    };

Now this is setup to prevent data usage, lag and so on.. Max limits on vehicles, command spaming vehicles into the server. Prevent server crashing.. blah blah blah....



If someone could help me with the concept of how I should go about scripting it, And maybe how I should add it to the server. I would be really happy.

Last I checked if a player/players happens to be in a vehicle and it is removed, This results in death and possible rage, Maybe even a /quit

DizzasTeR

Why not a loop? Just why? Why do loops exist? To loop through players in VCMP only? Use the loops...

Mötley

Quote from: Doom_Kill3R on Dec 21, 2016, 05:46 PMWhy not a loop? Just why? Why do loops exist? To loop through players in VCMP only? Use the loops...

Then how should I go about the loop? How should I go about detecting each seat a player is in? Maybe the player is a passenger and there is no driver, Maybe there is a driver and passenger... What is the max amount of players in one of the vehicle, Maybe the bus can hold a lot of players.. Not really sure about the max amount of players in certain vehicles..

DizzasTeR

Why not just straight up delete the vehicle? The players will just end up on foot nothing else.

Mötley

Quote from: Doom_Kill3R on Dec 21, 2016, 06:03 PMWhy not just straight up delete the vehicle? The players will just end up on foot nothing else.

Quote from: Mötley on Dec 21, 2016, 05:39 PMLast I checked if a player/players happens to be in a vehicle and it is removed, This results in death and possible rage, Maybe even a /quit

I will trust what you say, I have tested before in the past that players will die. I can no longer have two game windows open. So I can not re-check. Thanks for the advice

DizzasTeR

Death? Why? I don't recall that happening though...

Mötley

Could of been a script issue or a previous vcmp version not [0.4].

Can't recall I just remember it happening during testing..