Hi, does anyone know why this script doesn't work on DarkRP but it works on singleplayer? The gamemode we are using uses DarkRP 2.4.3
local cp = {(Vector(-1061.028442, 1939.733765, 660.031250)), (Vector(-947.828552, 1940.685181, 660.031250)), (Vector(-814.282959, 1972.857666, 660.031250)), (Vector(-597.031250, 2050.950684, 660.031250)), (Vector(-849.187561, 1758.039551, 660.031250))}
local overwatch = {(Vector(736.304993, 2905.598633, 524.031250)), (Vector(770.048584, 2535.163818, 524.031250)), (Vector(751.244629, 2640.835205, 524.031250)), (Vector(739.356201, 2750.301025, 524.031250))}
local conscript = {(Vector(-1705.714722, -405.432617, 140.031250)), (Vector(-1622.852783, -328.170349, 140.031250)), (Vector(-1705.184692, -240.112579, 140.031250))}
local administrator = {(Vector(890.037720, 3652.728027, 1791.031250)), (Vector(469.208435, 3702.187012, 1791.031250))}
local cremator = {(Vector(250.728149, 2662.148438, 524.031250)), (Vector(259.968750, 2552.305664, 524.031250))}
local stalker = {(Vector(512.140564, 3395.577881, 1727.031250)), (Vector(885.594543, 3396.360596, 1727.031250))}
local function xd (ply)
if (ply:Team() == TEAM_CP) then
ply:SetPos(table.Random(cp))
elseif (ply:Team() == TEAM_OVERWATCH) then
ply:SetPos(table.Random(overwatch))
elseif (ply:Team() == TEAM_CONSCRIPT) then
ply:SetPos(table.Random(conscript))
elseif (ply:Team() == TEAM_ADMINISTRATOR) then
ply:SetPos(table.Random(administrator))
elseif (ply:Team() == TEAM_CREMATOR) then
ply:SetPos(table.Random(cremator))
elseif (ply:Team() == TEAM_STALKER) then
ply:SetPos(table.Random(stalker))
end
end
hook.Add("PlayerSpawn", "hook6", xd)
First of all why don't you update your DarkRP?
Secondly, does it give an error? Does anything else not work? What happens?
The guy who has made the gamemode has edited the core DarkRP files ages ago. No errors and nothing happens.
local function xd (ply)
timer.Simple(0.1, function()
if (ply:Team() == TEAM_CP) then
ply:SetPos(table.Random(cp))
elseif (ply:Team() == TEAM_OVERWATCH) then
ply:SetPos(table.Random(overwatch))
elseif (ply:Team() == TEAM_CONSCRIPT) then
ply:SetPos(table.Random(conscript))
elseif (ply:Team() == TEAM_ADMINISTRATOR) then
ply:SetPos(table.Random(administrator))
elseif (ply:Team() == TEAM_CREMATOR) then
ply:SetPos(table.Random(cremator))
elseif (ply:Team() == TEAM_STALKER) then
ply:SetPos(table.Random(stalker))
end
end)
end
You are running it too fast and doing it before DarkRP set's your default position, adding a timer of 0.1 will run it next frame and should work.
update ur darkrp sir
I think table random is returning 2 values, index value and index chose, make it not to work, but anyway, it should error iirc
I got it working when I added a timer.
Thank you for the help guys.
Sorry, you need to Log In to post a reply to this thread.