Jump to content

Problem with callClientFunction


Spawn*

Recommended Posts

SERVER:

  
function CreateAccount(Player, Account, Password) 
  
    if(addAccount(Account, Password)) 
    then 
        callClientFunction("HideLoginGUI", Player) 
        else  
        outputChatBox("Essa Conta já existe.", Player, 255, 0, 0) 
    end 
end 
  
function callClientFunction(client, funcname, ...) 
  
    local arg = { ... } 
     
    if(arg[1])then 
     
        for key, value in next, arg do 
            if (type(value) == "number") then arg[key] = tostring(value) end 
        end 
    end 
    triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) 
end 
  
------------------------------------------------------------------------------------------------------------------------- 
  
addEvent("onClientCallsServerFunction", true) 
  
------------------------------------------------------------------------------------------------------------------------- 
  
addEventHandler("onClientCallsServerFunction", resourceRoot, callServerFunction) 
  
------------------------------------------------------------------------------------------------------------------------- 
  

and CLIENT:

  
function HideLoginGUI() 
  
    guiSetVisible(rGUI_theBox, not guiGetVisible(rGUI_theBox)) 
    guiSetVisible(rGUI_LbLCon, not guiGetVisible(rGUI_LbLCon)) 
    guiSetVisible(rGUI_LbLSen, not guiGetVisible(rGUI_LbLSen)) 
    guiSetVisible(rGUI_EdtCon, not guiGetVisible(rGUI_EdtCon)) 
    guiSetVisible(rGUI_EdtSen, not guiGetVisible(rGUI_EdtSen)) 
    guiSetVisible(rGUI_BtnLog, not guiGetVisible(rGUI_BtnLog)) 
    guiSetVisible(rGUI_BtnCat, not guiGetVisible(rGUI_BtnCat)) 
    guiSetVisible(rGUI_ImgGUI, not guiGetVisible(rGUI_ImgGUI)) 
    showCursor(false) 
end 
  
function callClientFunction(funcname, ...) 
  
    local arg = { ... } 
     
    if(arg[1]) 
    then 
        for key, value in next, arg do arg[key] = tonumber(value) or value end 
    end 
    loadstring("return "..funcname)()(unpack(arg)) 
end 
  

the error appears in the console: bad argument @ 'triggerClientEvent' [Expected element at argument 2, got string 'onServerClassClientFunction'

line:

triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) 

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