the link you sent me is exactly what I put in my client file.
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustPressed(1, 18) and IsPlayerDead(ped) then
revivePed()
TriggerEvent("chatMessage", "::", {255, 0, 0}, "^1Revived :::")
end
end
end)
function revivePed(ped) -- Credits to @Turtle
local ped = GetPlayerPed(-1)
local playerPos = GetEntityCoords(ped, true)
NetworkResurrectLocalPlayer(playerPos, true, true, false)
SetPlayerInvincible(ped, false)
ClearPedBloodDamage(ped)
end
well I put it like this, which Iām sure is wrong but I donāt know enough to know why
-- Turn off automatic respawn here instead of updating FiveM file.
AddEventHandler('onClientMapStart', function()
exports.spawnmanager:setAutoSpawn(false)
exports.spawnmanager:spawnPlayer()
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustPressed(1, 18) and IsPlayerDead(ped) then
revivePed()
end
end
end)
function revivePed(ped) -- Credits to @Turtle
local ped = GetPlayerPed(-1)
local playerPos = GetEntityCoords(ped, true)
NetworkResurrectLocalPlayer(playerPos, true, true, false)
SetPlayerInvincible(ped, false)
ClearPedBloodDamage(ped)
end
I cleared all my extra resources off before I tested this just to be sure. It still autorespawns, the button works as long as you push it before you respawn. Though it works correctly if I change this in spawnmanager to false.
-- changes the auto-spawn flag
function setAutoSpawn(enabled)
autoSpawnEnabled = false
end
I donāt really understand what you mean. I start the server then start the fivem up and join the server. I spawn as the skater kid, noclip into the sky and suicide, and itāll fade out and respawn me at a spawnpoint if I donāt press the button.
Well I made a completely new server and had only this script on, and it works but only for the first connected player. The other player just dies, ragdolls, and canāt respawn.
is there a way to stop RPDeath from spawning people randomly? when they first join the server? i have a script that spawns people in paleto but if i add this one it makes people spawn in different areas.
is it also possible to make it so instead of toggling no respawon on death that its just always on so they got to /respawn to be /revived?
@TheStonedTurtle can i type /revive id and revive a player as in what a medic can do. ive been trying to find an emergancy mod replacement and this might be it
Remove exports.spawnmanager:spawnPlayer() from RPDeath client.lua. This will require you to spawn them in some other way (which you seem to already be doing).
Iām not sure what you are asking in your second question. The RPDeath script is turned on by default so they must type /respawn or /revive.
@bluefir111, The `RPDeath` script should be what you are looking for, test it out :)
its on by default? because when i die it instantly respawns me after words if i dont turn it on first but maybe its because of my spawn script. iāll try what you said and see if that works.
Once the FxServer is officially released Iāll work on porting them over, Iāve ran into a couple issues that have been fixed by the FxServer being updated and no code changes being needed.