off Posted October 16, 2013 Author Share Posted October 16, 2013 For the player spawn: --client function onClientDied(killer, weapon, bodypart) local thePlayer = getLocalPlayer() triggerServerEvent('onPlayerDied', localPlayer, thePlayer) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), onClientDied) --server addEvent('onPlayerDied', true) addEventHandler('onPlayerDied', getRootElement(), function ( thePlayer ) setTimer(function() spawnPlayer(thePlayer, -2404.66943, -596.81165, 132.64844) end, 5000, 1) end) Set this "-2404.66943, -596.81165, 132.64844" to the position you want them to spawn and the '5000' after it ( again its in milliseconds ) Make sure you have them defined correctly in meta.xml. Like: I would set it for all spawns. Not just for one. Link to comment
off Posted October 16, 2013 Author Share Posted October 16, 2013 Image: function showClientImage() local img = guiCreateStaticImage( 0, 500, 59, 58, "image.png", false ) setTimer(function() destroyElement(img) end, 5000, 1) end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), showClientImage) Set the 5000 as you need ( its in milliseconds ) Thank you, it worked. Link to comment
mint3d Posted October 16, 2013 Share Posted October 16, 2013 I believe he is using freeroam so he is using default spawns for them Link to comment
off Posted October 16, 2013 Author Share Posted October 16, 2013 I believe he is using freeroam so he is using default spawns for them Exactly, I want this to be set for all. Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 Then you gotta edit the freeroam resource itself. Link to comment
off Posted October 16, 2013 Author Share Posted October 16, 2013 Then you gotta edit the freeroam resource itself. But I want a script that defines all, not a given. Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 I dont get what youre tryna say there... What do you want now? Link to comment
off Posted October 16, 2013 Author Share Posted October 16, 2013 I dont get what youre tryna say there... What do you want now? I want a script to set the spawn time without a coordinate. The script has to be applied in all the spawning. I do not want it now, I always wanted that. Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 Like you give a good number number of co-ordinates then spawn a player to one of them? Link to comment
off Posted October 16, 2013 Author Share Posted October 16, 2013 Like you give a good number number of co-ordinates then spawn a player to one of them? How? Link to comment
mint3d Posted October 16, 2013 Share Posted October 16, 2013 addEventHandler("onPlayerWasted", root, function() setTimer(spawn, 5000, 1, source) end ) You can add this to the image script if you wish or make it as a new file its client sided it should work timers in mil seconds or you can use this 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, 5000, 1, source) end ) Link to comment
pa3ck Posted October 16, 2013 Share Posted October 16, 2013 @mint3d that's a complete mess... Link to comment
mint3d Posted October 16, 2013 Share Posted October 16, 2013 Its better than your attempt Link to comment
pa3ck Posted October 17, 2013 Share Posted October 17, 2013 Its better than your attempt Mine was not an attempt, its working, i tried it. He just never said he wants the player to spawn to a random position. Yours is just full of stupid things like repeat until, you have not specified any arguments for spawnPlayer, you have restartMapInfo() I dont even know why etc... No offense tho... The code is: function randomSpawn() local tplayer = source spawnPlaces = { {10, 10, 10 }, -- Change them, you can also add more if you want to {20, 20, 10 }, {30, 30, 10 }, } local randomPlace = math.random(1, #spawnPlaces) setTimer( function() spawnPlayer(tplayer, spawnPlaces[randomPlace][1],spawnPlaces[randomPlace][2], spawnPlaces[randomPlace][3]) end, 5000, 1) end addEventHandler('onPlayerWasted', getRootElement(), randomSpawn) Link to comment
mint3d Posted October 17, 2013 Share Posted October 17, 2013 Ye but hes using freeroam with play so he can just change the timer on the play setting to how many mins he wants but ye anyways Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now