Max+ Posted April 4, 2013 Posted April 4, 2013 Hello Guys i got Problem with spawnManger i have but spawn point of Arena 20 it's Call on Admin Panel Police4 -- interior 3 but it's say setElementInterior Expected element at argument 1 got nill , and it's spawn in the sky -- Spawn manager , local spawns = { { x = 238.6613311767, y = 141.05133056641, z = 1003.0234375 }; { x = 190.87297058105, y = 158.49531555176, z = 1003.0234375 }; { x = 298.23620605496, y = 172.01306152344, z = 1007.171875 }; } -- Spawn manager , function spawn ( uPed ) local spawn = spawns [ math.random ( #spawns ) ] local x, y, z = spawn.x, spawn.y, spawn.z setElementInterior(uPed, 3, x, y, z) setElementDimension(uPed, 0) setTimer ( spawnPlayer, 2000, 1, uPed, x, y, z ) setTimer ( fadeCamera, 3000, 1, uPed, true, 0.5 ) setTimer ( setCameraTarget, 3000, 1, uPed, uPed ) showCursor ( uPed, false ) end -- Spawn manager , addEventHandler ( 'onPlayerWasted', root, function ( ) fadeCamera ( source, false, 1.0, 0, 0, 0 ); setTimer ( fadeCamera, 3500, 1, source, true, 0.5 ); local spawn = spawns [ math.random ( #spawns ) ] local x, y, z = spawn.x, spawn.y, spawn.z setElementInterior(uPed, 3, x, y, z) setElementDimension(uPed, 0) setTimer ( spawnPlayer, 3000, 1, source, x, y, z ); end )
Max+ Posted April 4, 2013 Author Posted April 4, 2013 it's defined in the function ! and the functions ,!
DNL291 Posted April 4, 2013 Posted April 4, 2013 You didn't show where uPed was defined. Also, tell which line is the problem.
Max+ Posted April 4, 2013 Author Posted April 4, 2013 it's defined Here ! function spawn ( uPed ) and problem it's spawn me on the sky not in Interior 3 ! ~
PaiN^ Posted April 4, 2013 Posted April 4, 2013 Check that all the coordinates in the spawn table are correct in the interior 3 ...
Max+ Posted April 4, 2013 Author Posted April 4, 2013 i swear they are correct but i get this error , setElementInterior Expected element at argument 1 got nill ,
Max+ Posted April 4, 2013 Author Posted April 4, 2013 and i sayed how to defined uPed when he is alredy defined in the function !
iPrestege Posted April 4, 2013 Posted April 4, 2013 Ok try this server side -- Spawn manager , local spawns = { { 238.6613311767, 141.05133056641, 1003.0234375 }; { 190.87297058105, 158.49531555176, 1003.0234375 }; { 298.23620605496, 172.01306152344, 1007.171875 } } -- Spawn manager , function spawn ( player ) if not isElement(player) then return end x,y,z = unpack(spawns[math.random(#spawns)]) setTimer ( spawnPlayer,3000,1,source, x, y, z,0,0,3,0 ); setTimer ( fadeCamera, 3000, 1, player, true, 0.5 ) setTimer ( setCameraTarget, 3000, 1, player, player ) showCursor ( player, false ) end addEventHandler ( 'onPlayerWasted', root, function ( ) fadeCamera ( source, false, 1.0, 0, 0, 0 ); setTimer ( fadeCamera, 3500, 1, source, true, 0.5 ); x,y,z = unpack(spawns[math.random(#spawns)]) setTimer ( spawnPlayer,3000,1,source, x, y, z,0,0,3,0 ); end )
Max+ Posted April 4, 2013 Author Posted April 4, 2013 Nope it's say server:11 Bad argument spawnPlayer .. i tryed like this and same error , local respawn = { }; -- Spawn manager , local spawns = { { x = 238.6613311767, y = 141.05133056641, z = 1003.0234375 }; { x = 190.87297058105, y = 158.49531555176, z = 1003.0234375 }; { x = 298.23620605496, y = 172.01306152344, z = 1007.171875 }; } -- Spawn manager , function spawn ( uPed ) local x, y, z unpack(spawns[math.random(#spawns)]) setElementInterior(uPed, 3) setTimer ( spawnPlayer, 2000, 1, uPed, x, y, z ) setTimer ( fadeCamera, 3000, 1, uPed, true, 0.5 ) setTimer ( setCameraTarget, 3000, 1, uPed, uPed ) showCursor ( uPed, false ) end -- Spawn manager , addEventHandler ( 'onPlayerWasted', root, function ( ) fadeCamera ( source, false, 1.0, 0, 0, 0 ); setTimer ( fadeCamera, 3500, 1, source, true, 0.5 ); local x, y, z unpack(spawns[math.random(#spawns)]) setElementInterior(uPed, 3) setTimer ( spawnPlayer, 3000, 1, source, x, y, z ); end ) -- Spawn manager ,
iPrestege Posted April 4, 2013 Posted April 4, 2013 Can you post full code? i try it with command function "spawn" and work's great no error's!
iPrestege Posted April 4, 2013 Posted April 4, 2013 oh, sorry my bad try this : -- Spawn manager , local spawns = { { 238.6613311767, 141.05133056641, 1003.0234375 }; { 190.87297058105, 158.49531555176, 1003.0234375 }; { 298.23620605496, 172.01306152344, 1007.171875 } } -- Spawn manager , function spawn ( player ) if not isElement(player) then return end x,y,z = unpack(spawns[math.random(#spawns)]) setTimer ( spawnPlayer,3000,1,player, x, y, z,0,0,3,0 ); setTimer ( fadeCamera, 3000, 1, player, true, 0.5 ) setTimer ( setCameraTarget, 3000, 1, player, player ) showCursor ( player, false ) end addEventHandler ( 'onPlayerWasted', root, function ( ) fadeCamera ( source, false, 1.0, 0, 0, 0 ); setTimer ( fadeCamera, 3500, 1, source, true, 0.5 ); x,y,z = unpack(spawns[math.random(#spawns)]) setTimer ( spawnPlayer,3000,1,source, x, y, z,0,0,3,0 ); end )
Max+ Posted April 4, 2013 Author Posted April 4, 2013 the word love you it's not enough for Fixing my Script Thank's Fahad Really . Topic Closed ,
iPrestege Posted April 4, 2013 Posted April 4, 2013 You're Welcome , I forget the player argument because that you get bad argument !
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