simplify DropPlayer example

This commit is contained in:
georgey 2025-01-16 09:47:39 +11:00
parent d26afe8630
commit 315c8d1f20

View File

@ -548,17 +548,14 @@ As guests are anonymous, you may want to disallow them to join, however it is re
Kicks the player with the specified ID. The reason parameter is optional. Kicks the player with the specified ID. The reason parameter is optional.
```lua ```lua
local player_id = 3 function ChatHandler(player_id, player_name, message)
local vcount = 0 if string.find(message, "damn") then
local player_vehicles = MP.GetPlayerVehicles(player_id) MP.DropPlayer(player_id, "Profanity is not allowed")
return 1
for vehicle_id, vehicle_data in pairs(player_vehicles) do else
vcount = vcount + 1 return 0
if vcount > 1 then
MP.RemoveVehicle(player_id, vehicle_id)
MP.DropPlayer(player_id, "You can only have one vehicle spawned at once.")
end end
end end
``` ```
#### `MP.GetStateMemoryUsage() -> number` #### `MP.GetStateMemoryUsage() -> number`