Jump to content

setTimer(bindKey... problem)


Recommended Posts

Posted

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

Posted

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.

Posted

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  
     

Posted

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 

Posted
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 

Posted (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 by Guest
Posted
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) 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...