Tete omar Posted July 23, 2012 Posted July 23, 2012 Hello guys i got a problem here , setTimer( bindKey, 5000, 1, source, "F", "down", herewego ) i want to set timer for bindKey , but it doesn't work debugscript : nothing
AMARANT Posted July 23, 2012 Posted July 23, 2012 Have you put in function "herewego" debug-message? What did it say? Make sure that in client-side version of this function you shouldn't set 'player' argument.
Tete omar Posted July 23, 2012 Author Posted July 23, 2012 full code function setCameraOnPlayerJoin() fadeCamera(source, true, 1); setCameraMatrix(source, -2135.708984375, -187.71142578125, 157.66786193848, 0, 0, 0); setTimer( bindKey, 5000, 1, source, "F", "down", herewego ) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin); function herewego ( thePlayer ) gX, gY, gZ = getElementPosition ( thePlayer ) setCameraTarget ( thePlayer ) setElementPosition ( thePlayer, 2450.7463378906, -1659.6678466797, 13.3046875 ) fadeCamera(source, true, 1); setElementFrozen ( thePlayer, false ) unbindKey( thePlayer, "F", "down", herewego ) end
Tete omar Posted July 23, 2012 Author Posted July 23, 2012 debug-message? What did it say? debugscript : nothing
AMARANT Posted July 23, 2012 Posted July 23, 2012 debugscript is not the same thing as debug message. Debug message is just "outputChatBox" function. Try this code: function setCameraOnPlayerJoin() fadeCamera(source, true, 1); setCameraMatrix(source, -2135.708984375, -187.71142578125, 157.66786193848, 0, 0, 0); setTimer( bindKey, 5000, 1, source, "f", "down", herewego, source ) end addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin); function herewego ( thePlayer ) gX, gY, gZ = getElementPosition ( thePlayer ) setCameraTarget ( thePlayer ) setElementPosition ( thePlayer, 2450.7463378906, -1659.6678466797, 13.3046875 ) fadeCamera(source, true, 1); setElementFrozen ( thePlayer, false ) unbindKey( thePlayer, "f", "down", herewego ) end
TAPL Posted July 23, 2012 Posted July 23, 2012 function setCameraOnPlayerJoin() fadeCamera(source, true, 1) setCameraMatrix(source, -2135.708984375, -187.71142578125, 157.66786193848, 0, 0, 0) setTimer(function(player) bindKey(player, "F", "down", herewego) end,5000,1,source) end addEventHandler("onPlayerJoin", root, setCameraOnPlayerJoin) function herewego(player) local gX, gY, gZ = getElementPosition(player) -- you need this? setCameraTarget(player) setElementPosition(player, 2450.7463378906, -1659.6678466797, 13.3046875) fadeCamera(player, true, 1) setElementFrozen(player, false) unbindKey(player, "F", "down", herewego) end
Jaysds1 Posted July 23, 2012 Posted July 23, 2012 For some reason when you add any functions to the setTimer which includes a handlingfunction it says that's it's not added, anyways, try this: http://pastebin.com/S6yf2iak
Tete omar Posted July 23, 2012 Author Posted July 23, 2012 (edited) @TAPL i can spawn my self using F whenever i want, not after 5 sec @jaysds i can't press F anymore lol and thanks for the both of you Edited July 23, 2012 by Guest
TAPL Posted July 23, 2012 Posted July 23, 2012 For some reason when you add any functions to the setTimer which includes a handlingfunction it says that's it's not added,anyways, try this: http://pastebin.com/S6yf2iak i already post the solution, but still your won't work setTimer(function() bindKey(source, "f", "down", herewego ) end,5000, 1) should be setTimer(function(player) bindKey(player, "f", "down", herewego ) end,5000, 1,source)
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