Hi,
I’m new to fivem scripting and I’m trying to figure out the dropPlayer native to kick a player from server.
I’ve passed source as argument but I’m getting the following error.
InvokeNative: execution failed: Argument at index 0 was null.
SCRIPT ERROR: Execution of native 00000000ba0613e1 in script host failed.
> handler (@loginsignup/login-s.lua:18)
Line 18 of the login-s.lua is the dropPlayer native calling
login-c.lua
local spawnPos = vector3(686.245, 577.950, 130.461)
local display = true
AddEventHandler('onClientGameTypeStart', function()
SetDisplay(not display)
TriggerServerEvent("connectingsteam")
exports.spawnmanager:setAutoSpawnCallback(function()
exports.spawnmanager:spawnPlayer({
x = spawnPos.x,
y = spawnPos.y,
z = spawnPos.z,
model = 'a_m_m_skater_01'
}, function()
TriggerEvent('chat:addMessage', {
args = { 'Welcome to the party!~' }
})
end)
end)
exports.spawnmanager:setAutoSpawn(true)
exports.spawnmanager:forceRespawn()
end)
login-s.lua
RegisterServerEvent("connectingsteam")
AddEventHandler("connectingsteam", function(source)
DropPlayer(source, 'connect to steam') --THIS IS LINE 18
end)