Electro88 Posted April 13, 2016 Share Posted April 13, 2016 (edited) i want player register spawn this first code but not working i added onPlayerRegister function wasted (player) if not isElement(player) then return end local x, y, z = 2192.42578125, -1781.095703125, 313.29595947266 local x2, y2, z2 = -1230.02612, 451.12631, 7.18750 local x3, y3, z3 = 2815.3291015625, -1461.5537109375, 32.126281738281 local lvl = tonumber(getElementData(player,"Level") ) if (lvl >= 0) then spawnPlayer (player, x, y, z ) giveWeapon(player, 46) giveWeapon(player, 22,90) setElementModel(player, 0) if (lvl >= 1) then spawnPlayer (player, x2, y2, z2 ) if (lvl >= 15) then spawnPlayer (player, x3, y3, z3 ) fadeCamera( player, true) setCameraTarget( player, player) end end end end addEventHandler ( "onPlayerWasted", root, function() setTimer(wasted, 5000, 1, source) end) -- Event Handlers addEventHandler ( "onPlayerRegister", getRootElement(), wasted) Edited April 15, 2016 by Guest Link to comment
Seba500PLK Posted April 13, 2016 Share Posted April 13, 2016 Electro88 said: i want player register spawn this first code but not working i added onPlayerRegister function wasted (player) if not isElement(player) then return end local x, y, z = 2192.42578125, -1781.095703125, 313.29595947266 local x2, y2, z2 = -1230.02612, 451.12631, 7.18750 local x3, y3, z3 = 2815.3291015625, -1461.5537109375, 32.126281738281 local lvl = tonumber(getElementData(player,"Level") ) if (lvl >= 0) then spawnPlayer (player, x, y, z ) giveWeapon(player, 46) giveWeapon(player, 22,90) setElementModel(player, 0) if (lvl >= 1) then spawnPlayer (player, x2, y2, z2 ) if (lvl >= 15) then spawnPlayer (player, x3, y3, z3 ) fadeCamera( player, true) setCameraTarget( player, player) end end end end addEventHandler ( "onPlayerWasted", root, function() setTimer(wasted, 5000, 1, source) end) -- Event Handlers addEventHandler ( "onPlayerRegister", getRootElement(), wasted) what is onPlayerRegister ? Link to comment
Captain Cody Posted April 13, 2016 Share Posted April 13, 2016 onPlayerLogin* function wasted () local player = source if not isElement(player) then return end local x, y, z = 2192.42578125, -1781.095703125, 313.29595947266 local x2, y2, z2 = -1230.02612, 451.12631, 7.18750 local x3, y3, z3 = 2815.3291015625, -1461.5537109375, 32.126281738281 local lvl = tonumber(getElementData(player,"Level") ) if (lvl >= 0) then spawnPlayer (player, x, y, z ) giveWeapon(player, 46) giveWeapon(player, 22,90) setElementModel(player, 0) elseif (lvl >= 1) then spawnPlayer (player, x2, y2, z2 ) elseif (lvl >= 15) then spawnPlayer (player, x3, y3, z3 ) fadeCamera( player, true) setCameraTarget( player, player) end end end addEventHandler ( "onPlayerWasted", root, function() setTimer(wasted, 5000, 1, source) end) -- Event Handlers addEventHandler ( "onPlayerLogin", getRootElement(), wasted) Link to comment
Electro88 Posted April 13, 2016 Author Share Posted April 13, 2016 onPlayerLogin Not working Link to comment
Ahmed Ly Posted April 13, 2016 Share Posted April 13, 2016 function wasted () local player = source if not isElement(player) then return end local x, y, z = 2192.42578125, -1781.095703125, 313.29595947266 local x2, y2, z2 = -1230.02612, 451.12631, 7.18750 local x3, y3, z3 = 2815.3291015625, -1461.5537109375, 32.126281738281 local lvl = tonumber(getElementData(player,"Level") ) if (lvl >= 0) then spawnPlayer (player, x, y, z ) giveWeapon(player, 46) giveWeapon(player, 22,90) setElementModel(player, 0) elseif (lvl >= 1) then spawnPlayer (player, x2, y2, z2 ) elseif (lvl >= 15) then spawnPlayer (player, x3, y3, z3 ) fadeCamera( player, true) setCameraTarget( player, player) end end end addEventHandler ( "onPlayerWasted", root, function() setTimer(wasted, 5000, 1, source) end) -- Event Handlers addEventHandler ( "onPlayerLogin",root, function() setTimer(wasted, 5000, 1, source) end) Link to comment
KariiiM Posted April 13, 2016 Share Posted April 13, 2016 Try this function wasted () local player = source if not isElement(player) then return end local x, y, z = 2192.42578125, -1781.095703125, 313.29595947266 local x2, y2, z2 = -1230.02612, 451.12631, 7.18750 local x3, y3, z3 = 2815.3291015625, -1461.5537109375, 32.126281738281 local lvl = tonumber(getElementData(player,"Level")) or 0 if (lvl >= 0) then spawnPlayer (player, x, y, z ) giveWeapon(player, 46) giveWeapon(player, 22,90) setElementModel(player, 0) elseif (lvl >= 1) then spawnPlayer (player, x2, y2, z2 ) elseif (lvl >= 15) then spawnPlayer (player, x3, y3, z3 ) fadeCamera( player, true) setCameraTarget( player, player) end end addEventHandler ( "onPlayerWasted", root, function() setTimer(wasted, 5000, 1, source) end) addEventHandler ( "onPlayerLogin", getRootElement(), function() wasted() end) Link to comment
Ahmed Ly Posted April 13, 2016 Share Posted April 13, 2016 Electro88 said: Not working debugscript? Link to comment
KariiiM Posted April 13, 2016 Share Posted April 13, 2016 function wasted () local player = source if not isElement(player) then return end local x, y, z = 2192.42578125, -1781.095703125, 313.29595947266 local x2, y2, z2 = -1230.02612, 451.12631, 7.18750 local x3, y3, z3 = 2815.3291015625, -1461.5537109375, 32.126281738281 local lvl = tonumber(getElementData(player,"Level")) or 0 if (lvl >= 0) then spawnPlayer (player, x, y, z ) giveWeapon(player, 46) giveWeapon(player, 22,90) setElementModel(player, 0) fadeCamera( player, true) setCameraTarget( player, player) elseif (lvl >= 1) then spawnPlayer (player, x2, y2, z2 ) fadeCamera( player, true) setCameraTarget( player, player) elseif (lvl >= 15) then spawnPlayer (player, x3, y3, z3 ) fadeCamera( player, true) setCameraTarget( player, player) end end addEventHandler ( "onPlayerWasted", root, function() setTimer(wasted, 5000, 1, source) end) addEventHandler ( "onPlayerLogin", getRootElement(), function() wasted() end) Link to comment
Electro88 Posted April 13, 2016 Author Share Posted April 13, 2016 Lol thanks for trying but not working why ? what the problem ? Link to comment
KariiiM Posted April 13, 2016 Share Posted April 13, 2016 Electro88 said: Lol thanks for trying but not working why ? what the problem ? Can you debug the code? What I had posted seems fine Link to comment
Electro88 Posted April 13, 2016 Author Share Posted April 13, 2016 Debug is clear not giving error only no spawn. Link to comment
Ahmed Ly Posted April 13, 2016 Share Posted April 13, 2016 function wasted (player) local x, y, z = 2192.42578125, -1781.095703125, 313.29595947266 local x2, y2, z2 = -1230.02612, 451.12631, 7.18750 local x3, y3, z3 = 2815.3291015625, -1461.5537109375, 32.126281738281 local lvl = tonumber(getElementData(player,"Level") ) if (lvl >= 0) then spawnPlayer (player, x, y, z ) giveWeapon(player, 46) giveWeapon(player, 22,90) setElementModel(player, 0) elseif (lvl >= 1) then spawnPlayer (player, x2, y2, z2 ) elseif (lvl >= 15) then spawnPlayer (player, x3, y3, z3 ) fadeCamera( player, true) setCameraTarget( player, player) end end function d () setTimer(wasted, 5000, 1, source) end addEventHandler ( "onPlayerWasted", root, d) function login () setTimer(wasted, 5000, 1, source) end addEventHandler ( "onPlayerLogin",root, login) Link to comment
Electro88 Posted April 13, 2016 Author Share Posted April 13, 2016 i fix it other level spawns but i registered new account i dont spawn i see just screen not spawning how to fix it ah.. Link to comment
AlvarO Posted April 14, 2016 Share Posted April 14, 2016 setCameraTarget(localPlayer,localPlayer) Try that instead of player. Link to comment
KariiiM Posted April 14, 2016 Share Posted April 14, 2016 AlvarO said: setCameraTarget(localPlayer,localPlayer) Try that instead of player. In client side, no need for double targets, plus he is scripting in server side not client side. Link to comment
Electro88 Posted April 14, 2016 Author Share Posted April 14, 2016 Well i how fix it ? Link to comment
Ahmed Ly Posted April 14, 2016 Share Posted April 14, 2016 Electro88 said: i fix it other level spawns but i registered new account i dont spawn i see just screen not spawning how to fix it ah.. #Client addEventHandler("onClientGUIClick",root, function() if source == Button.register then triggerServerEvent("spn",localPlayer) end end ) #Server function playerspawn () spawnPlayer(2815.3291015625, -1461.5537109375, 32.126281738281) setPlayerSkin(source,46) end addEvent("spn",true) addEventHandler("spn",root,playerspawn) Link to comment
KariiiM Posted April 14, 2016 Share Posted April 14, 2016 He means by writing #Client & #Server (client side) & (server side) Link to comment
Electro88 Posted April 14, 2016 Author Share Posted April 14, 2016 yeah i did it i get error : ERROR: Newlevel/client.lua:2: attempt to index global 'Button' (a nil Value) Link to comment
KariiiM Posted April 15, 2016 Share Posted April 15, 2016 Electro88 said: yeah i did it i get error : ERROR: Newlevel/client.lua:2: attempt to index global 'Button' (a nil Value) Show your gui code Link to comment
Electro88 Posted April 15, 2016 Author Share Posted April 15, 2016 Login System ? but not my own script Link to comment
Electro88 Posted April 15, 2016 Author Share Posted April 15, 2016 Lol... i fix it i need just add fadeCamera and SetCameraTarget thanks all for trying function wasted (player) if not isElement(player) then return end local x, y, z = 2192.42578125, -1781.095703125, 313.29595947266 local x2, y2, z2 = -1230.02612, 451.12631, 7.18750 local x3, y3, z3 = 2815.3291015625, -1461.5537109375, 32.126281738281 local lvl = tonumber(getElementData(player,"Level") ) if (lvl >= 0) then spawnPlayer (player, x, y, z ) fadeCamera( player, true) setCameraTarget( player, player) giveWeapon(player, 46) giveWeapon(player, 22,90) setElementModel(player, 0) if (lvl >= 1) then spawnPlayer (player, x2, y2, z2 ) if (lvl >= 15) then spawnPlayer (player, x3, y3, z3 ) fadeCamera( player, true) setCameraTarget( player, player) end end end end 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