Jump to content

[HELP] Why this error?


Recommended Posts

Client:

        close = guiCreateButton(312, 169, 266, 66, "Darmelo", false, GUIEditor.window[1]) 
  
        guiSetProperty(close, "NormalTextColour", "FFAAAAAA") 
  
function hola ( ) 
    local row, col = guiGridListGetSelectedItem ( source ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local arma = guiGridListGetItemText ( source, row, 1 ) 
        if ( arma == "Jetpack" ) then 
    triggerServerEvent ( thePlayer, "setJetpack", thePlayer ) 
        end 
    end 
end 
addEventHandler( "onClientGUIClick", close, hola, false)  
  

Server:

function daselo() 
     local yatiene = giveWeapon ( thePlayer, 41, 99999 ) 
      outputChatBox ( "Tes has colocado el Spray!", thePlayer, 255, 0, 0, true ) 
    if (yatiene) then 
      outputChatBox ( "Ya tienes el Spray!", thePlayer, 255, 0, 0, true ) 
end 
end 
addEvent("setJetpack", true) 
addEventHandler("setJetpack", getRootElement(), darselo) 

Debug:

'addEventHandler' [Expected function at argument 2, got nil]

Link to comment
--Client 
       close = guiCreateButton(312, 169, 266, 66, "Darmelo", false, GUIEditor.window[1]) 
  
        guiSetProperty(close, "NormalTextColour", "FFAAAAAA") 
  
function hola ( ) 
if source == close then 
    local row, col = guiGridListGetSelectedItem ( source ) 
    if ( row and col and row ~= -1 and col ~= -1 ) then 
        local arma = guiGridListGetItemText ( source, row, 1 ) 
        if ( arma == "Jetpack" ) then 
    triggerServerEvent ( "setJetpack", localPlayer  ) 
        end 
    end 
end 
end 
addEventHandler( "onClientGUIClick", root, hola) 
  
--Server 
function daselo() 
    local yatiene = giveWeapon ( source, 41, 99999 ) 
    if (yatiene) then 
      outputChatBox ( "Tes has colocado el Spray!", source, 255, 0, 0, true ) 
    else 
      outputChatBox ( "Ya tienes el Spray!", source, 255, 0, 0, true ) 
    end 
end 
addEvent("setJetpack", true) 
addEventHandler("setJetpack", getRootElement(), darselo) 
  

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