-.Paradox.- Posted June 25, 2013 Share Posted June 25, 2013 (edited) addEventHandler( "onResourceStart", resourceRoot, function() resetMapInfo() for _,player in ipairs( getElementsByType 'player' ) do spawn( player ) end end ) function spawn( player ) if not isElement( player ) then return end showChat( player, true ) local acc = getPlayerAccount( player ) if acc and not isGuestAccount( acc ) then if isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Forever" ) ) then spawnPlayer ( player, 220.19960021973, 1825.8579101563, 6.4140625, 0, 45 ) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Monster Energy" ) ) then spawnPlayer ( player, 1146.5582509766, 2334.53515625, 10.829927444458 , 90, 228) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Saint Rows" ) ) then spawnPlayer ( player, 2481.5187988281, 2356.2329101563, 4.2109375, 90, 17) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Iron Weasel" ) ) then spawnPlayer ( player, 1075.8477783203, 1252.1403808594, 10.8203125, 90, 17) end end fadeCamera( player, true ) setCameraTarget( player, player ) end addEventHandler( "onPlayerJoin", root, function( ) spawn( source ) end) addEventHandler( "onPlayerWasted", root, function( ) setTimer( spawn, 500, 1, source ) end) The trouble is when a default player join the game he dont spawn at the locations of spawn like groove or ganton or missionary hills or pirate ship, Help please Edited June 25, 2013 by Guest Link to comment
-.Paradox.- Posted June 25, 2013 Author Share Posted June 25, 2013 This resource work only if i disable play gamemode but default player dont spawn Link to comment
Cadu12 Posted June 25, 2013 Share Posted June 25, 2013 Change "onPlayerJoin" to "onPlayerLogin". Link to comment
iMr.3a[Z]eF Posted June 25, 2013 Share Posted June 25, 2013 you have a lot mistakes addEventHandler( "onResourceStart", resourceRoot, function( player ) resetMapInfo() for _,player in ipairs( getElementsByType ("player") ) do spawn( player ) end end ) function spawn( player ) if not isElement( player ) then return end showChat( player, true ) local acc = getPlayerAccount( player ) if acc and not isGuestAccount( acc ) then if isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Forever" ) ) then spawnPlayer ( player, 220.19960021973, 1825.8579101563, 6.4140625, 0, 45 ) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Monster Energy" ) ) then spawnPlayer ( player, 1146.5582509766, 2334.53515625, 10.829927444458 , 90, 228) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Saint Rows" ) ) then spawnPlayer ( player, 2481.5187988281, 2356.2329101563, 4.2109375, 90, 17) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Iron Weasel" ) ) then spawnPlayer ( player, 1075.8477783203, 1252.1403808594, 10.8203125, 90, 17) end end fadeCamera( player, true ) setCameraTarget( player, player ) end addEventHandler( "onPlayerLogin", root, function( ) spawn( source ) end) addEventHandler( "onPlayerWasted", root, function( ) setTimer( spawn, 500, 1, source ) end) Link to comment
-.Paradox.- Posted June 25, 2013 Author Share Posted June 25, 2013 if i runned play can it work ? Link to comment
Castillo Posted June 25, 2013 Share Posted June 25, 2013 You would need to edit "play" script. Link to comment
-.Paradox.- Posted June 25, 2013 Author Share Posted June 25, 2013 Oh how ? can you send me a lua example ? Link to comment
Castillo Posted June 25, 2013 Share Posted June 25, 2013 Replace the content of "play/broph.lua" with: 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 local acc = getPlayerAccount( player ) if acc and not isGuestAccount( acc ) then if isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Forever" ) ) then spawnPlayer ( player, 220.19960021973, 1825.8579101563, 6.4140625, 0, 45 ) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Monster Energy" ) ) then spawnPlayer ( player, 1146.5582509766, 2334.53515625, 10.829927444458 , 90, 228) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Saint Rows" ) ) then spawnPlayer ( player, 2481.5187988281, 2356.2329101563, 4.2109375, 90, 17) elseif isObjectInACLGroup ( "user.".. getAccountName( acc ), aclGetGroup ( "Iron Weasel" ) ) then spawnPlayer ( player, 1075.8477783203, 1252.1403808594, 10.8203125, 90, 17) else if get("spawnreset") == "onSpawn" then spawnpoint = getRandomSpawnPoint() end exports.spawnmanager:spawnPlayerAtSpawnpoint(player,spawnpoint,false) repeat until setElementModel(player,math.random(312)) end end showChat(player, true) fadeCamera( player, true ) setCameraTarget( player, player ) 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 ) Link to comment
-.Paradox.- Posted June 25, 2013 Author Share Posted June 25, 2013 can i ask? it wont remove the default players spawnpoint ? Link to comment
Castillo Posted June 25, 2013 Share Posted June 25, 2013 No, it'll spawn players in default spawnpoints if they aren't on these ACL groups. 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