i am using this script for revive and respawn my goal was to use a piece of code for my script my goal was to have spawn points where if you died inside the red zena you pressed the respawn button and chose random a spawn i tried more than once but i couldn’t do it anyone know how to help me?
my problem is that it always uses the rp revive script first and not the one in my script
this is my clean script with no implementation
local zones = {
{ ['x'] = -234.77, ['y'] = -1580.82, ['z'] = 25.89},
}
local notifIn = false
local notifOut = false
local In = false
local Out = false
local closestZone = 1
function CreateBlipCircle(coords, text, radius, color, sprite)
local blip = AddBlipForRadius(coords, radius)
SetBlipHighDetail(blip, true)
SetBlipColour(blip, 1)
SetBlipAlpha (blip, 200)
-- create a blip in the middle 128
blip = AddBlipForCoord(coords)
SetBlipHighDetail(blip, true)
SetBlipSprite (blip, sprite)
SetBlipScale (blip, 1.0)
SetBlipColour (blip, 4)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(text)
EndTextCommandSetBlipName(blip)
end
Citizen.CreateThread(function()
for k,zone in pairs(Config.CircleZones) do
CreateBlipCircle(zone.coords, zone.name, zone.radius, zone.color, zone.sprite)
end
end)
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) do
Citizen.Wait(0)
end
while true do
local playerPed = GetPlayerPed(-1)
local x, y, z = table.unpack(GetEntityCoords(playerPed, true))
local minDistance = 100000
for i = 1, #zones, 1 do
dist = Vdist(zones[i].x, zones[i].y, zones[i].z, x, y, z)
if dist < minDistance then
minDistance = dist
closestZone = i
end
end
Citizen.Wait(15000)
end
end)
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) do
Citizen.Wait(0)
end
while true do
Citizen.Wait(0)
local player = GetPlayerPed(-1)
local x,y,z = table.unpack(GetEntityCoords(player, true))
local dist = Vdist(Config.Zones.marker.x, Config.Zones.marker.y, Config.Zones.marker.z, x, y, z)
if dist <= 50.0 then
NetworkSetFriendlyFireOption(true)
ClearPlayerWantedLevel(PlayerId())
GiveWeaponToPed(player,0xBFE256D4,999)
GiveWeaponComponentToPed(player,0xBFE256D4,0x21E34793)
GiveWeaponComponentToPed(player,0xBFE256D4,0x8ED4BB70)
GiveWeaponComponentToPed(player,0xBFE256D4,0x5ED6C128)
SetCurrentPedWeapon(player,0xBFE256D4,true)
end
if notifIn then
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if Q then
DisableControlAction(0, 80, false)
end
end
end)
end
if DoesEntityExist(player) then
DrawMarker(1, Config.Zones.marker.x, Config.Zones.marker.y, Config.Zones.marker.z-1.0001, 0, 0, 0, 0, 0, 0, Config.Zones.Cerchio.x, Config.Zones.Cerchio.y, Config.Zones.Cerchio.z, Config.Zones.Color.R, Config.Zones.Color.G, Config.Zones.Color.B, 100, 0, 0, 2, 0, 0, 0, 0)
end
end
end)
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) do
Citizen.Wait(0)
end
while true do
Citizen.Wait(0)
local player = GetPlayerPed(-1)
local x,y,z = table.unpack(GetEntityCoords(player, true))
local dist = Vdist(Config.Zones.marker.x, Config.Zones.marker.y, Config.Zones.marker.z, x, y, z)
if dist <= 50.0 then -- Enable pvp inside area
NetworkSetFriendlyFireOption(true)
SetCanAttackFriendly(playerPed, true, true)
end
end
end)
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) do
Citizen.Wait(0)
end
while true do
Citizen.Wait(2000)
local player = GetPlayerPed(-1)
local x,y,z = table.unpack(GetEntityCoords(player, true))
local dist = Vdist(Config.Zones.marker.x, Config.Zones.marker.y, Config.Zones.marker.z, x, y, z)
end
end)
Citizen.CreateThread(function()
while not NetworkIsPlayerActive(PlayerId()) do
Citizen.Wait(0)
end
while true do
Citizen.Wait(2000)
local player = GetPlayerPed(-1)
local x,y,z = table.unpack(GetEntityCoords(player, true))
local dist = Vdist(Config.Zones.marker.x, Config.Zones.marker.y, Config.Zones.marker.z, x, y, z)
end
end)