roaddog Posted June 27, 2014 Share Posted June 27, 2014 Hello guys, In this case, I want to make bind to open gui but this code doesnt work at all. And debugscript says ERROR: house_system\core\core_server.lua:134: attempt to index a boolean value addEventHandler( 'onColShapeHit', m_Enter, function( player ) if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then exports["topbarchat"]:sendClientMessage("#FFFFFFPress #FF0000'H' #FFFFFFto open house gui!",player, 10, 255, 10, false, 1) if not getElementData( player, 'HP_Opened' ) then if not isGuestAccount( getPlayerAccount( player ) ) then setElementData( player, 'mrk_in', getElementData( source, 'HS_INFO' )[9] ); outputChatBox("really?") bindKey(player, 'h', "down", onPlayerHouseMarkerHit, player, source, true) else exports["topbarchat"]:sendClientMessage( '* You must be logged in to get in this house!', player, 255, 51, 36, true ); end; end; end; end ); addEventHandler( 'onColShapeLeave', m_Enter, function( player ) if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then unbindKey(player, 'h', "down", onPlayerHouseMarkerHit) setElementData( player, 'mrk_in', nil ); end; end ); function onPlayerHouseMarkerHit( player, mrk, cursor ) local acc = getPlayerAccount( player ); if isGuestAccount( acc ) then exports["topbarchat"]:sendClientMessage( '* You must be logged in to get in this house!', player, 255, 51, 36,true ); setElementData( player, 'mrk_in', nil ); setPedFrozen( player, false ); return false; end; local tts = { [1] = true, [2] = false, [3] = false, [4] = true, [5] = false, [6] = false }; if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( 'Admin' ) ) or hasObjectPermissionTo( player, 'function.banPlayer', false ) then tts[6] = true; end; local owner = getElementData( player, 'HS_INFO' )[7]; ----its actually here, the line 134 local accName = getAccountName( acc ); if owner == accName then tts[1] = false; tts[2] = true; tts[3] = true; tts[4] = true; tts[5] = true; end; if owner ~= accName and owner ~= '' then tts[1] = false; end; if owner == '' then if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( 'Admin' ) ) or hasObjectPermissionTo( player, 'function.banPlayer', false ) then tts[4] = true; else tts[4] = false; end; end; tts[7] = getElementData( mrk, 'HS_INFO' )[9]; tts[8] = getElementData( mrk, 'HS_INFO' )[7]; tts[9] = getElementData( mrk, 'HS_INFO' )[6]; triggerClientEvent( player, 'openHouseManagementWnd', root, tts, cursor ); end; Thank you. Link to comment
roaddog Posted June 27, 2014 Author Share Posted June 27, 2014 local owner = getElementData( player, 'HS_INFO' )[7]; ----its actually here, the line 134 Link to comment
Castillo Posted June 27, 2014 Share Posted June 27, 2014 You are never setting the "HS_INFO" element data to the player, at least not in that code. Link to comment
roaddog Posted June 28, 2014 Author Share Posted June 28, 2014 Oh nvm i got to do this, the element was a house not a player local owner = getElementData( mrk, 'HS_INFO' )[7]; Fixed Thank you Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now