Jump to content

Problem with house system


Genius

Recommended Posts

Bad argument @: addEventHandler[Expected element at argument 2 ]

function createpick () 
    if ( source == GUIEditor_Button[1] ) then 
    x, y, z = getElementPosition ( source ) 
    housepick = createPickup( x, y, z, 2, 1273, 1 ) 
    addEventHandler ( "onClientPickupHit", housepick, hitpick ) -- Here is problem 
    end 
end 
addEventHandler("onClientGUIClick",root,createpick ) 

Link to comment
Guest Guest4401

Try

function createpick () 
    if ( source == GUIEditor_Button[1] ) then 
    x, y, z = getElementPosition ( localPlayer ) 
    housepick = createPickup( x, y, z, 2, 1273, 1 ) 
    addEventHandler ( "onClientPickupHit", housepick, hitpick ) 
    end 
end 
addEventHandler("onClientGUIClick",root,createpick ) 

And make sure that hitpick is a function.

Link to comment
Try
function createpick () 
    if ( source == GUIEditor_Button[1] ) then 
    x, y, z = getElementPosition ( localPlayer ) 
    housepick = createPickup( x, y, z, 2, 1273, 1 ) 
    addEventHandler ( "onClientPickupHit", housepick, hitpick ) 
    end 
end 
addEventHandler("onClientGUIClick",root,createpick ) 

And make sure that hitpick is a function.

I have that function, but its dont work :/

Link to comment
function hitpick(player, matchingDimension) 
    if matchingDimension then 
        outputChatBox("You hit a pickup.", player, 0, 255, 0, false) 
    end 
end 
  
addEventHandler("onClientGUIClick", root, 
    function() 
        if source == GUIEditor_Button[1] then 
            local x, y, z = getElementPosition(localPlayer) 
            local housepick = createPickup(x, y, z, 2, 1273, 1) 
            addEventHandler("onClientPickupHit", housepick, hitpick) 
        end 
    end, 
    false 
) 

Link to comment
function hitpick(player, matchingDimension) 
    if matchingDimension then 
        outputChatBox("You hit a pickup.", player, 0, 255, 0, false) 
    end 
end 
  
addEventHandler("onClientGUIClick", root, 
    function() 
        if source == GUIEditor_Button[1] then 
            local x, y, z = getElementPosition(localPlayer) 
            local housepick = createPickup(x, y, z, 2, 1273, 1) 
            addEventHandler("onClientPickupHit", housepick, hitpick) 
        end 
    end, 
    false 
) 

Dont work :/

Link to comment

Try This ,

local housepick = createPickup(x, y, z, 2, 31, 1273, 1) 
function pickup1 () 
outputChatBox('You Have Picked up the god damn pickup !',255,255,0) 
end 
addEventHandler('onClientPickupHit', housepick, pickup1) 
  
addEvent('onClientGUIClick', root, 
function() 
if ( source == GUIEditor_Button[1] ) then 
local x, y, z = getElementPosition(source) 
end 
end) 

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