I want to make a command to kick all players.
Hey Mario14!
Is this what u need?
This is server side script.
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterCommand('kickall', function(source, args, rawCommand)
kickPl()
end, true)
function kickPl ()
local xPlayers = ESX.GetPlayers()
for i=1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
xPlayer.kick("Kicked all players.")
end
end
Hello DMTRR! Yes but i want to do this command kickall to do only the console. And i want when player get kicked say you kicked because server restard !!
Could just make it maybe like a admin command, Then when your about to restart have an admin kick everyone?
how to make this a admin command?
Or to do it Whitelisted command with steam id