Jump to content

help-bindKey


roaddog

Recommended Posts

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

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