Jump to content

setTimer(bindKey... problem)


Tete omar

Recommended Posts

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  
     

Link to comment

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 

Link to comment
  • Other Languages Moderators
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 

Link to comment
  • Other Languages Moderators
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) 

Link to comment

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...