BieHDC Posted June 3, 2013 Share Posted June 3, 2013 Hello, i wanna make a script, that onPlayerSpawn makes timer to 16secs and than make an explosion. I have that: -- client side addEventHandler("onPlayerSpawn", resourceRoot, expl) setTimer (expl, 16000, 1, createExplosion) createExplosion (836.5 , -2047, 12.5, 10 , true, -1.0, false) Link to comment
Castillo Posted June 3, 2013 Share Posted June 3, 2013 addEventHandler ( "onClientPlayerSpawn", root, function ( ) local x, y, z = getElementPosition ( source ) setTimer ( createExplosion, 16000, 1, x, y, z, 10, true, -1.0, false ) end ) Link to comment
BieHDC Posted June 3, 2013 Author Share Posted June 3, 2013 Would it look so with coordinates? addEventHandler ( "onClientPlayerSpawn", root, function ( ) local x, y, z = getElementPosition ( source ) setTimer ( createExplosion, 16000, 1, 836.5, -2047, 12.5, 10, true, -1.0, false ) end ) Link to comment
Castillo Posted June 3, 2013 Share Posted June 3, 2013 Yes, I replaced it with player position because I though you wanted to create it on his/her position. Link to comment
BieHDC Posted June 4, 2013 Author Share Posted June 4, 2013 So would that be right and working? and can i make a 2nd 3rd.... if i copy the 5 lines and make other coordinates? addEventHandler ( "onClientPlayerSpawn", root, function ( ) setTimer ( createExplosion, 16000, 1, 836.5, -2047, 12.5, 10, true, -1.0, false ) end ) Link to comment
iPrestege Posted June 4, 2013 Share Posted June 4, 2013 You can make a table much easier ; ) . Link to comment
iPrestege Posted June 4, 2013 Share Posted June 4, 2013 local ExplosionPosition = { [1] = { x,y,z }, [2] = { x,y,z }, [3] = { x,y,z }, [4] = { x,y,z }, } This is a table and please get the results by yourself . Link to comment
BieHDC Posted June 4, 2013 Author Share Posted June 4, 2013 Would the script look then so? local ExplosionPosition = { [1] = { x,y,z }, [2] = { x,y,z }, [3] = { x,y,z }, [4] = { x,y,z }, } addEventHandler ( "onClientPlayerSpawn", root, function ( ) local x, y, z = getElementPosition ( ExplosionPosition ) setTimer ( createExplosion, 16000, 1, x, y, z, 10, true, -1.0, false ) end ) Link to comment
iPrestege Posted June 4, 2013 Share Posted June 4, 2013 No this is a wrong way try this ; local ExplosionPosition = { [1] = { x,y,z }, [2] = { x,y,z }, [3] = { x,y,z }, [4] = { x,y,z }, } addEventHandler ( "onClientPlayerSpawn", root, function ( ) for _,v in ipairs ( ExplosionPosition ) do local x,y,z = v[1],v[2],v[3] setTimer ( createExplosion, 16000, 1, x, y, z, 10, true, -1.0, false ) end end ) Link to comment
BieHDC Posted June 4, 2013 Author Share Posted June 4, 2013 And this creates 4 explosions with 16sec delay and all exploding at the same time? Link to comment
BieHDC Posted June 4, 2013 Author Share Posted June 4, 2013 works perfect If i need a bigger script in future i will pay you^^ Link to comment
BieHDC Posted June 4, 2013 Author Share Posted June 4, 2013 How could i pay you if i would need a script? Link to comment
Castillo Posted June 4, 2013 Share Posted June 4, 2013 I would recommend using just one timer. 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