So, to describe my little problem shortly, I want to kick a player after he press a button, well I do this in client.lua with a Citizen thread and made something like this:
Citizen.CreateThread(function(source)
while true do
Citizen.Wait(0)
if IsControlJustPressed(13,201) then
local playerIdx = GetPlayerFromServerId(source)
local ped = GetPlayerPed(playerIdx)
TriggerServerEvent("drop", ped)
end
end
end)
and in Server.lua
RegisterServerEvent("drop")
AddEventHandler("drop", function(ped)
print("got signal")
DropPlayer(ped, "You have exited the game")
end)
but for some reason it does not work, I can’t get it to what I want…
if someone could help me than this would be awesome! <3