Jump to content

ERROR: play\broph.lua:27: bad argument #2 to 'random' (interval is empty)


Recommended Posts

ERROR: play\broph.lua:27: bad argument #2 to 'random' (interval is empty) << PEOPLE TRYING LOGIN BUT GAME EXITING I MEAN I  DONT KNOW

 

AND AFTER I FIX THIS SHOW >>>

 

ERROR: spawnmanager\spawn.lua:148: bad argument #2 to 'random' (interval is empty)
[2021-03-21 22:01:59] ERROR: play\broph.lua:18: call: failed to call 'spawnmanager:spawnPlayerAtSpawnpoint' [string "?"]

Link to comment

so @tut you closed and now i cant see these posts u closed :(  how i ill solve my problem

On 22/03/2021 at 05:37, xLive said:

We need more details
the play game mode does not use the spawnmanager

Can you show where are you using spawnPlayerAtSpawnpoint function?
did you try to create a spawnpoint before spawning?

 

ERROR: play\broph.lua:27: bad argument #2 to 'random' (interval is empty)

ERROR: play\broph.lua:27: bad argument #2 to 'random' (interval is empty)

i mean when someone try login this show in the server... i just look and some people not all try to login and  some times quit the game but other players login normally...

local spawnpoint

addEventHandler("onResourceStart", resourceRoot,
	function()
		spawnpoint = getRandomSpawnPoint()
		resetMapInfo()
		for i,player in ipairs(getElementsByType("player")) do
			spawn(player)
		end
	end
)

function spawn(player)
	if not isElement(player) then return end
	if get("spawnreset") == "onSpawn" then
		spawnpoint = getRandomSpawnPoint()
	end
	exports.spawnmanager:spawnPlayerAtSpawnpoint(player,spawnpoint,false)
	repeat until setElementModel(player,math.random(312))
	fadeCamera(player, true)
	setCameraTarget(player, player)
	showChat(player, true)
end

function getRandomSpawnPoint ()
	local spawnpoints = getElementsByType("spawnpoint")
	return spawnpoints[math.random(1,#spawnpoints)]
end

addEventHandler("onPlayerJoin", root,
	function()
		spawn(source)
	end
)

addEventHandler("onPlayerQuit",root,
	function ()
		if getPlayerCount() == 1 and get("spawnreset") == "onServerEmpty" then
			spawnpoint = getRandomSpawnPoint()
		end
	end
)

addEventHandler("onPlayerWasted", root,
	function()
		setTimer(spawn, 1800, 1, source)
	end
)

 

 

i really dont know coding, i just know edit. i tried to delete this line and i got a error in line 18... i dont know if you guys have a correct play archive or correct broph.lua

Link to comment

i dont know? my bro, i really dont remember if i changed any in this archive. my player spawn in LS in a spawn i choosed. and when die he  respawn on hospital of ls... can u guys ffix it 

On 24/03/2021 at 09:53, Erlkonig said:

Why is there nothing at "spawnpoints"? I guess it should be the table with spawn coordinates. Did not you changed the line with "local spawnpoints"? 
The script trying to get the array size but there nothing is.

 

On 22/03/2021 at 05:37, xLive said:

We need more details
the play game mode does not use the spawnmanager

Can you show where are you using spawnPlayerAtSpawnpoint function?
did you try to create a spawnpoint before spawning?

 

helppp

Link to comment
On 24/03/2021 at 14:53, Erlkonig said:

Why is there nothing at "spawnpoints"? I guess it should be the table with spawn coordinates. Did not you changed the line with "local spawnpoints"? 
The script trying to get the array size but there nothing is.

Nah, read carefully the names of the variables - spawnpoint and spawnpoints!

The "spawnpoint" variable is used to be sent to the spawnmanager and the "spawnpoints" is to get all the elements of type "spawnpoint".
For some reason there are no spawnpoints (maybe the responsible resource for that is not running?) so it says that the interval is empty.

To the author: Are you sure you started all the required resources ?

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...