Jump to content

Fadecamera bindKey not working


Miika

Recommended Posts

My fadeCamera bindkey not working.

WANRNING: teams/teams.lua:32: Bad argument @ 'bindKey' [Expected player at argument, 1 got nil] 

[server]

function fadeBind(thePlayer) 
if ( getCameraTarget == true ) then  
    fadeCamera(thePlayer, false, 1) 
else 
    fadeCamera(thePlayer, true, 1) 
end 
end 
bindKey(thePlayer, "f12", "down", fadeBind) 

Link to comment
  • Moderators

client

addEventHandler("onClientResourceStart",resourceRoot, 
function () 
    triggerServerEvent("bindKeysFadeCamera",localPlayer)-- when the player has loaded 
end) 
  

server

function fadeBind(thePlayer) 
if getCameraTarget(thePlayer) then 
    fadeCamera(thePlayer, false, 1) 
else 
    fadeCamera(thePlayer, true, 1) 
end 
end 
  
addEvent("bindKeysFadeCamera",true) 
addEventHandler("bindKeysFadeCamera",root, 
function () 
    if isElement(client) then 
         bindKey(client, "f12", "down", fadeBind) 
    end 
end) 

Link to comment
client
addEventHandler("onClientResourceStart",resourceRoot, 
function () 
    triggerServerEvent("bindKeysFadeCamera",localPlayer)-- when the player has loaded 
end) 
  

server

function fadeBind(thePlayer) 
if getCameraTarget(thePlayer) then 
    fadeCamera(thePlayer, false, 1) 
else 
    fadeCamera(thePlayer, true, 1) 
end 
end 
  
addEvent("bindKeysFadeCamera",true) 
addEventHandler("bindKeysFadeCamera",root, 
function () 
    if isElement(client) then 
         bindKey(client, "f12", "down", fadeBind) 
    end 
end) 

wtf??

  
function resourceStart () 
    for k, p in ipairs (getElementsByType("player")) do 
        bindKey(p, "F12", "down", fadeBind, p) 
    end 
end 
addEventHandler ("onResourceStart", resourceRoot, resourceStart) 
  
function playerJoins() 
    bindKey(source, "F12", "down", fadeBind, source) 
end 
addEventHandler("onPlayerJoin", root, playerJoins) 
  

Link to comment
client
addEventHandler("onClientResourceStart",resourceRoot, 
function () 
    triggerServerEvent("bindKeysFadeCamera",localPlayer)-- when the player has loaded 
end) 
  

server

function fadeBind(thePlayer) 
if getCameraTarget(thePlayer) then 
    fadeCamera(thePlayer, false, 1) 
else 
    fadeCamera(thePlayer, true, 1) 
end 
  
end 
  
addEvent("bindKeysFadeCamera",true) 
addEventHandler("bindKeysFadeCamera",root, 
function () 
    if isElement(client) then 
         bindKey(client, "f12", "down", fadeBind) 
    end 
end) 

black screen

Edited by Guest
Link to comment
  • Moderators

wtf??

It can be done more ways, I only need one event, you two.

My example will reduce warnings when re-communicate with the clients directly after the binds.

Also gives the option to register players and start large data transfers without problems.

But yours is quicker.

@Miika822

what is it Miika822?

Edited by Guest
Link to comment

wtf??

It can be done more ways, but mine will reduce warnings when re-communicate with the clients directly after the binds.

Also gives the option to register players and start large data transfers without problems.

But yours is quicker.

@Miika822

what is it Miika822?

But what if someone joined the server?

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