So lately I’ve been getting myself into trying to code a gamemode for my community, where I wanted to use
SwitchOutPlayer as part of a transition between parts of the world when teleporting, but I’ve run into some problem, that I hope someone would be able to help me solve.
First off, the little snippet of code, that i almost always use to test small bits of clientside code:
Citizen.CreateThread(function() while true do Citizen.Wait(0) if IsControlJustPressed(0,38) then SwitchOutPlayer(PlayerPedId(),0,1) --Brings up the player. SetEntityCoords(PlayerPedId(),-97.489700317383,241.09867858887,99.021774291992, 1, 0, 0, 1) --Predefined for testing N_0xd8295af639fd9cb8(PlayerPedId()) --Brings down the player. end end end)
This code works fine, if i chose to comment out
And the error it gives me back in the F8 console:
Error resuming coroutine: client.lua:5: attempt to call a nil value (global 'SwitchOutPlayer') stack traceback: client.lua:5: in function <client.lua:1>
So far, this is what I have tried myself:
- Using GetPlayerPed(-1) instead of PlayerPedId()
- Tried changing the numbers around 1,0 and 1,1
But with no luck at all. So I’m not entirely sure, what is attempting to call a nil value in there.
If anyone is able to help, i would appreciate it alot. If not enough information is given, i will happily provide more. Thanks.