mirror of
https://github.com/BeamMP/Docs.git
synced 2025-07-01 23:45:46 +00:00
change RemoveVehicle() example to simple iteration
Co-authored-by: Tixx <83774803+WiserTixx@users.noreply.github.com>
This commit is contained in:
parent
318a80ed1c
commit
4e8601b0fd
@ -498,15 +498,11 @@ Removes the specified vehicle for the specified player.
|
|||||||
Example:
|
Example:
|
||||||
```lua
|
```lua
|
||||||
local player_id = 3
|
local player_id = 3
|
||||||
local vcount = 0
|
|
||||||
local player_vehicles = MP.GetPlayerVehicles(player_id)
|
local player_vehicles = MP.GetPlayerVehicles(player_id)
|
||||||
|
|
||||||
|
-- Loop over all of player 3's vehicles and delete them
|
||||||
for vehicle_id, vehicle_data in pairs(player_vehicles) do
|
for vehicle_id, vehicle_data in pairs(player_vehicles) do
|
||||||
vcount = vcount + 1
|
MP.RemoveVehicle(player_id, vehicle_id)
|
||||||
if vcount > 1 then
|
|
||||||
MP.RemoveVehicle(player_id, vehicle_id)
|
|
||||||
MP.SendChatMessage(player_id, "You cannot have more than one vehicle spawned")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user