Kors Posted May 10, 2018 Share Posted May 10, 2018 When player, register and enter the server, he spawn in LSPD , how can i fix thet? in borph.lua i set my position but thet work when player die, addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function spawn(player) spawnPlayer ( player, -728.69219970703+math.random(1,1), 1547.8328857422+math.random(1,1),38.977741241455, 90, 71 ) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerLogin", root, function() spawn(source) end ) addEventHandler("onPlayerWasted", root, function() local skin = getElementModel ( source ) setTimer(spawn, 1800, 1, source) setTimer(setElementModel, 1800, 1, source, skin) end ) Link to comment
Storm-Hanma Posted May 11, 2018 Share Posted May 11, 2018 (edited) For that you need to add on player login or on player join function then add your xyz positions Edited May 11, 2018 by Khadeer143 1 Link to comment
Kors Posted May 11, 2018 Author Share Posted May 11, 2018 Can you add ? 1 hour ago, Khadeer143 said: For that you need to add on player login or on player join function then add your xyz positions I add , line 15, thet not work ? Link to comment
Dimos7 Posted May 11, 2018 Share Posted May 11, 2018 Post the code the errors or warnings Link to comment
Kors Posted May 11, 2018 Author Share Posted May 11, 2018 No warnings, no errors, addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function spawn(player) spawnPlayer ( player, -728.69219970703+math.random(1,1), 1547.8328857422+math.random(1,1),38.977741241455, 90, 71 ) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerLogin", root, function() spawn(source) end ) addEventHandler("onPlayerWasted", root, function() local skin = getElementModel ( source ) setTimer(spawn, 1800, 1, source) setTimer(setElementModel, 1800, 1, source, skin) end ) Link to comment
Dimos7 Posted May 11, 2018 Share Posted May 11, 2018 why you put it spawn sam location when resource start login and when it dead? Link to comment
Kors Posted May 11, 2018 Author Share Posted May 11, 2018 (edited) I don’t understand , how fix , what remove , wHat add Edited May 11, 2018 by Kors Link to comment
Storm-Hanma Posted May 12, 2018 Share Posted May 12, 2018 (edited) Take this has example which is working add this in any server side script folder or create a new folder ! local randomSpawnTable = { { 270.92654418945, -1986.3665771484, 797.52966308594 }, { 270.92654418945, -1986.3665771484, 797.52966308594 }, { 270.92654418945, -1986.3665771484, 797.52966308594 } } addEventHandler("onPlayerLogin",getRootElement(), function() spawnPlayer(source,unpack(randomSpawnTable[math.random(#randomSpawnTable)])) setCameraTarget(source,source) setElementModel(source, 312) giveWeapon(source,46) giveWeapon(source,9) giveWeapon(source,25,5000,true) giveWeapon(source,28,5000,true) giveWeapon(source,31,5000,true) giveWeapon(source,22,5000,true) end) Removed give weapon if you don't want and replace spawn xyz positions,remove element model & camera target also if you don't want ,this will spawn player after they login !! Edited May 12, 2018 by Khadeer143 1 Link to comment
Kors Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) Dont work :C i spawn in lspd , i think i have resource with thet spawn in lspd Edited May 12, 2018 by Kors Link to comment
Kors Posted May 12, 2018 Author Share Posted May 12, 2018 (edited) ------------------ Yeah, tnx all for try help me , my misstake , resource save-system, is set pos spawn in lspd. Edited May 12, 2018 by Kors 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