change RemoveVehicle() example to simple iteration

Co-authored-by: Tixx <83774803+WiserTixx@users.noreply.github.com>
This commit is contained in:
Samuel Towers 2025-01-16 09:44:22 +11:00 committed by GitHub
parent 318a80ed1c
commit 4e8601b0fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -498,15 +498,11 @@ Removes the specified vehicle for the specified player.
Example:
```lua
local player_id = 3
local vcount = 0
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
vcount = vcount + 1
if vcount > 1 then
MP.RemoveVehicle(player_id, vehicle_id)
MP.SendChatMessage(player_id, "You cannot have more than one vehicle spawned")
end
MP.RemoveVehicle(player_id, vehicle_id)
end
```