Jump to content

مساعده في كودين فقط


Recommended Posts

السلام عليكم ورحمة الله وبركاته شباب انا توني جديد في المنتدى واتمنى انكم تساعدوني

:D :D :D :D :D :D :D :D :D :D :D :D

عندي مود بيوت وابي اسوي عليه مود عقارات يعني حبيت ادمج المودين في بعض واللي استغربت منه ان مافي ولا احد صنع المود واللي صنع المود تلاقي الرابط حقه خربان

فانا حاولت صناعته بس وقفت على كودين واكون خلصته اللي هم

يظهرلك البيوت الغير مشتريه في الجريدلست

طيب هذا الاول والثاني انك اذا حددت الاتيم تكست من الجريد لست ابي حدث للزر انه ينقلك على حسب التكست اللي متحدد

طبعا الاول يعني اذا ما فهمتوني بطريقه اسهل انك تضيف

row بالبيوت كامله اللي محد مشتريها

والثاني حدث الزر على حسب تحديدك لل

row

من الكولم اللي في الجريد لست

طيب الحين بعرض لكم الاكواد اتمنى انكم ما تنشروها هي بسيطه بس احب اني

اخذها واحطها في سيرفري فاتمنا انكم ما تنشروها

    GUIEditor_Window = {} 
    GUIEditor_Button = {} 
    GUIEditor_Gridlist = {} 
      
         GUIEditor_Window[1] = guiCreateWindow(89, 46, 592, 497, "مود العقارات الحصري من قبل ماستر", false) 
    guiSetVisible(GUIEditor_Window[1],false) 
      
            guiSetAlpha(GUIEditor_Window[1], 0.81) 
            master = guiCreateButton(259, 39, 307, 67, "انتقل", false, GUIEditor_Window[1]) 
            master12 = guiCreateButton(259, 183, 307, 67, "اغلق النافذه", false, GUIEditor_Window[1]) 
            master123 = guiCreateGridList(9, 27, 244, 454, false, GUIEditor_Window[1]) 
  
 guiGridListAddColumn(master123, "#", 1)     
        guiGridListAddColumn(master123, "السعر", 2)     
      
    function showGUI2() 
    guiSetVisible (GUIEditor_Window[1],true) 
    showCursor(true) 
    end 
    addEvent("showGUI2",true) 
    addEventHandler("showGUI2",getRootElement(),showGUI2) 
      
    addEvent("hideGUI2",true) 
    addEventHandler("hideGUI2",getRootElement(), 
    function () 
    guiSetVisible(GUIEditor_Window[1],false) 
    showCursor (false) 
    end) 
    addEventHandler("onClientGUIClick",root,function () 
    if ( source == master12 ) then 
    guiSetVisible(GUIEditor_Window[1], false) 
    showCursor(false) 
    guiSetInputEnabled(false) 
      
    end 
    end) 
  

Link to comment

يعني زي كذا

بس هذا يظهر اللاعبين

function clientsideResourceStart () 
        local playerList = guiCreateGridList(9, 27, 244, 454, false, GUIEditor_Window[1]) -- Create the grid list 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) -- Create a 'players' column in the list 
        if ( column ) then -- If the column was successfully created 
                for id, playeritem in ipairs(getElementsByType("player")) do  
                --Loop through all the players, adding them to the table 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), clientsideResourceStart ) 
  

انا ابي بدل اللاعبين البيوت اللي محد شاريها

Link to comment

يعني هذا كذا يظهر الاعبين انا ابي البيوت

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Gridlist = {} 
  
     GUIEditor_Window[1] = guiCreateWindow(89, 46, 592, 497, "مود العقارات الحصري من قبل ماستر", false) 
guiSetVisible(GUIEditor_Window[1],false) 
  
        guiSetAlpha(GUIEditor_Window[1], 0.81) 
        master = guiCreateButton(259, 39, 307, 67, "انتقل", false, GUIEditor_Window[1]) 
        master12 = guiCreateButton(259, 183, 307, 67, "اغلق النافذه", false, GUIEditor_Window[1]) 
        
         
function clientsideResourceStart () 
        local playerList = guiCreateGridList(9, 27, 244, 454, false, GUIEditor_Window[1]) -- Create the grid list 
        local column = guiGridListAddColumn( playerList, "Player", 0.85 ) -- Create a 'players' column in the list 
        if ( column ) then -- If the column was successfully created 
                for id, playeritem in ipairs(getElementsByType("player")) do  
                --Loop through all the players, adding them to the table 
                        local row = guiGridListAddRow ( playerList ) 
                        guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) 
                end 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), clientsideResourceStart ) 
  
function showGUI2() 
guiSetVisible (GUIEditor_Window[1],true) 
showCursor(true) 
end 
addEvent("showGUI2",true) 
addEventHandler("showGUI2",getRootElement(),showGUI2) 
  
addEvent("hideGUI2",true) 
addEventHandler("hideGUI2",getRootElement(), 
function () 
guiSetVisible(GUIEditor_Window[1],false) 
showCursor (false) 
end) 
addEventHandler("onClientGUIClick",root,function () 
if ( source == master12 ) then 
guiSetVisible(GUIEditor_Window[1], false) 
showCursor(false) 
guiSetInputEnabled(false) 
  
end 
end) 

Link to comment

امم مدري طريقتي صح او لا سوي للبيوت الي ماشروها داتا

وسوي بالمود ذا يلف ع الاوبجكتات كلها ويجيب الي عندها داتا محد شراها

وتتحدث اللوحة كل ماحد فتحها للشخص الي فتحها

عشان لمن حد يشتري بيت مايظهر بالقريدليست ..

ماظن يمديك صعب شويات

Link to comment

اخوي فاهم قصدك المود منضاف له داتا بس مدري كيف افصل اللي الناس اشتروه عن اللي ما شروه

addEventHandler( 'onResourceStart', resourceRoot, function() 
  sql.Query( "CREATE TABLE IF NOT EXISTS house_data (\ 
    ID INTEGER, en_X REAL, en_Y REAL, en_Z REAL,\ 
    en_tX REAL, en_tY REAL, en_tZ REAL,\ 
    ex_X REAL, ex_Y REAL, ex_Z REAL,\ 
    ex_tX REAL, ex_tY REAL, ex_tZ REAL,\ 
    int INTEGER, dim INTEGER, cost INTEGER, owner TEXT, key TEXT )" 
  ); 
  for i, v in ipairs( getElementsByType( 'player' ) ) do 
    setElementData( v, 'k_len', tonumber( get( 'keyLength' ) ) ); 
    local acc = getPlayerAccount( v ); 
    if not isGuestAccount( acc ) then 
      setElementData( v, 'HS_accountName', getAccountName( acc ) ); 
    end; 
    setElementData( v, 'mrk_in', nil ); 
  end; 
  local hr = sql.Query( "SELECT * FROM house_data" ); 
  for i = 1, #hr do 
    createHouse( false, hr[i].ID, hr[i].owner, hr[i].key, hr[i].en_X, hr[i].en_Y, hr[i].en_Z, hr[i].en_tX, hr[i].en_tY, hr[i].en_tZ, hr[i].ex_X, hr[i].ex_Y, hr[i].ex_Z, hr[i].ex_tX, hr[i].ex_tY, hr[i].ex_tZ, hr[i].int, hr[i].dim, hr[i].cost ); 
  end; 
end ); 
  
  

Link to comment

شف رح مود البيوت وعند ماتسوي بيت

ضيفه بالقريد ليست وطبعا يفضل انك تستخدم السكل

executeSQLQuery 

وطبعا حط سعر البيت و مكانه بالقريد

ويوم واحد يشتريه تحذفه من القاعدة

هذي افضل طريقة اشوفها

Link to comment
  • 4 weeks later...

اخوي يعني مثلا جاني 100 زائر ويبولهم 200

بيت مش معقول اضيف 200 بيت بجريد لست مع احترامي

لفكرتك تنفع بس

في الاشياء الصغيره زي لوحة الانتقالات وكذا

+

انا مالي خبره في السكل ولا جربت اتعامل معه مره هذا مود بيوت جاهز وانا معدل عليه

انا ما اسرق حقوق احد

Link to comment

اخوي يعني مثلا جاني 100 زائر ويبولهم 200

بيت مش معقول اضيف 200 بيت بجريد لست مع احترامي

لفكرتك تنفع بس

في الاشياء الصغيره زي لوحة الانتقالات وكذا

+

انا مالي خبره في السكل ولا جربت اتعامل معه مره هذا مود بيوت جاهز وانا معدل عليه

انا ما اسرق حقوق احد

Link to comment
طيب اخوي ممكن تعطيني الكود لاني بامانه مو عارف شي عن السكل نهائي وحاولت وما نفع معي

لو تبي اطرح المود كامل سيرفر وكلنت ابشر

:? غريبة منت خايف أنه أحد يسرق المود

Link to comment
طيب اخوي ممكن تعطيني الكود لاني بامانه مو عارف شي عن السكل نهائي وحاولت وما نفع معي

لو تبي اطرح المود كامل سيرفر وكلنت ابشر

:? غريبة منت خايف أنه أحد يسرق المود

Link to comment

سيرفر : -

  
--server 
function getNotSoldhouses() 
    local tab = {} 
    local sql = sql.Query( "SELECT * FROM house_data" ); 
    for i,v in ipairs(sql) do  
        if v['owner'] == '' then 
            table.insert(tab,{x = v['ex_tX'],y = v['ex_tY'],z = v['ex_tZ'] ,cost = v['cost']} ) 
        end 
    end 
    return tab 
end 
  
function refreshGridList() 
    triggerClientEvent(root,'refreshGridList',root, getNotSoldhouses() ) 
end 
  
setTimer(function() 
 refreshGridList() 
 end 
,10000,0) 
  

كلينت : -

  
 -- client 
  local screen = {guiGetScreenSize()} 
        GridList = guiCreateGridList(screen[1]/3,screen[2]/3,500,250,false,nil) 
       guiGridListAddColumn(GridList,'#',0.2) 
       guiGridListAddColumn(GridList,'Price',0.4) 
       guiGridListAddColumn(GridList,'x',0.1) 
       guiGridListAddColumn(GridList,'y',0.1) 
       guiGridListAddColumn(GridList,'z',0.1) 
        
      addEvent('refreshGridList',true) 
      addEventHandler('refreshGridList',root, 
        function(t) 
            guiGridListClear(GridList) 
            for i,v in ipairs(t) do  
                local row = guiGridListAddRow(GridList) 
                guiGridListSetItemText(GridList,row,1,tostring(i),false,false) 
                guiGridListSetItemText(GridList,row,2,tostring('$'..v['cost']),false,false) 
                guiGridListSetItemText(GridList,row,3,tostring(v['x']),false,false) 
                guiGridListSetItemText(GridList,row,4,tostring(v['y']),false,false) 
                guiGridListSetItemText(GridList,row,5,tostring(v['z']),false,false) 
            end 
        end 
    ) 
  

هذا مثال أتمنى تكون فهمت منه :?

Link to comment

ابشر تفضل معليش متعبكم معي

سيرفر سايد

########################################

marker1 = createMarker (3506.05029,-1902.46777,11.88437-1,"cylinder",1.2,0,0,225,100) 
function showGUI(hitPlayer)
triggerClientEvent (hitPlayer,"showGUI2",getRootElement(),hitPlayer)
end
addEventHandler ("onMarkerHit",marker1,showGUI)
 
addEventHandler("onMarkerLeave",marker1,
function (leavePlayer)
triggerClientEvent(leavePlayer,"hideGUI2",leavePlayer)
end)
 
function getNotSoldhouses()
    local tab = {}
    local sql = sql.Query( "SELECT * FROM house_data" );
    for i,v in ipairs(sql) do
        if v['owner'] == '' then
            table.insert(tab,{x = v['en_tX'],y = v['en_tY'],z = v['en_tZ'] ,cost = v['cost']} )
        end
    end
    return tab
end
 
function refreshGridList()
    triggerClientEvent(root,'refreshGridList',root, getNotSoldhouses() )
end
 
setTimer(function()
 refreshGridList()
 end
,10000,0)
 
 
 
 
 
function joinHandler(player)
    if not player then
        player = source
    end
    local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255)
    setPlayerNametagColor(player, r, g, b)
    g_PlayerData[player] = { vehicles = {} }
    g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b)
    if g_FrozenTime then
        clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather)
    end
    if getOption('welcometextonstart') then
        outputChatBox('►▌ Welcome In [M.L] Server ▐◄', player, 255,0,0)
    outputChatBox("#ffff00لتفعيل رؤية البيوت اضغط حرف خ ضغطه واحده [#33ff00Mas#000000ter#ff0000]تم تشغيل مود البيوت المعدل من قبل ",0,255,0,true)
outputChatBox("#ffff00skype [#33ff00Mas#000000ter#ffff00] #ff0000= [#33ff00ali_mt1999#ff0000]",255,0,0,true)
outputChatBox("#ffff00=========#ff0000>#33ff00Mas#000000ter#ff0000<#ffff00=========",0,255,0,true)     
        outputChatBox('►▌ skype: ali_mt1999 ▐◄', player, 255,255,0)
    end
end
addEventHandler('onPlayerJoin', g_Root, joinHandler)
local sql = { Query = executeSQLQuery };
 
addEventHandler( 'onResourceStart', resourceRoot, function()
  sql.Query( "CREATE TABLE IF NOT EXISTS house_data (\
   ID INTEGER, en_X REAL, en_Y REAL, en_Z REAL,\
   en_tX REAL, en_tY REAL, en_tZ REAL,\
   ex_X REAL, ex_Y REAL, ex_Z REAL,\
   ex_tX REAL, ex_tY REAL, ex_tZ REAL,\
   int INTEGER, dim INTEGER, cost INTEGER, owner TEXT, key TEXT )"
  );
  for i, v in ipairs( getElementsByType( 'player' ) ) do
    setElementData( v, 'k_len', tonumber( get( 'keyLength' ) ) );
    local acc = getPlayerAccount( v );
    if not isGuestAccount( acc ) then
      setElementData( v, 'HS_accountName', getAccountName( acc ) );
    end;
    setElementData( v, 'mrk_in', nil );
  end;
  local hr = sql.Query( "SELECT * FROM house_data" );
  for i = 1, #hr do
    createHouse( false, hr[i].ID, hr[i].owner, hr[i].key, hr[i].en_X, hr[i].en_Y, hr[i].en_Z, hr[i].en_tX, hr[i].en_tY, hr[i].en_tZ, hr[i].ex_X, hr[i].ex_Y, hr[i].ex_Z, hr[i].ex_tX, hr[i].ex_tY, hr[i].ex_tZ, hr[i].int, hr[i].dim, hr[i].cost );
  end;
end );
 
addEventHandler( 'onResourceStop', resourceRoot, function()
  for i, v in ipairs( getElementsByType( 'player' ) ) do
    setElementData( v, 'k_len', nil );
    setElementData( v, 'HS_accountName', nil );
  end;
end );
 
addEventHandler( 'onPlayerJoin', root, function()
  setElementData( source, 'k_len', tonumber( get( 'keyLength' ) ) );
end );
 
addEventHandler( 'onPlayerLogin', root, function( _, acc )
  setElementData( source, 'HS_accountName', getAccountName( acc ) );
end );
 
addEventHandler( 'onPlayerLoout', root, function( _, acc )
  setElementData( source, 'HS_accountName', nil );
end );
 
addCommandHandler( 'hpanel', function( player )
  if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( 'House' ) ) or hasObjectPermissionTo( player, 'command.banip', false ) then
    if not getElementData( player, 'HP_Opened' ) and not getElementData( player, 'mrk_in' ) then
      triggerClientEvent( player, 'HP_SetVisible', root, true );
    end;
  else
    outputChatBox( '* Access denied for this command!', player, 255, 36, 51 );
  end;
end );
 
addEvent( 'onPlayerAttemptCreateHouse', true );
addEventHandler( 'onPlayerAttemptCreateHouse', root, function( rt )
  createHouse( true, #sql.Query( "SELECT * FROM house_data" ) + 1, '', '', unpack( rt ) );
  outputChatBox( '* تهانينا تم تكوين بيت جديد!', client, 255, 255, 0 );
end );
 
function createHouse( add, ID, owner, key, eX, eY, eZ, etX, etY, etZ, exX, exY, exZ, extX, extY, extZ, int, dim, cost )
  if add then
    sql.Query( "INSERT INTO house_data ( ID, en_X, en_Y, en_Z, en_tX, en_tY, en_tZ, ex_X, ex_Y, ex_Z, ex_tX, ex_tY, ex_tZ, int, dim, cost, owner, key ) VALUES ( "..ID..", "..eX..", "..eY..", "..eZ..", "..etX..", "..etY..", "..etZ..", "..exX..", "..exY..", "..exZ..", "..extX..", "..extY..", "..extZ..", "..int..", "..dim..", "..cost..", '', '' )" );
  end;
 
  local m_Enter = createMarker( eX, eY, eZ - 1, 'cylinder', 1.25, 0, 153, 255, 150 );
  setElementData( m_Enter, 'HS_INFO', { etX, etY, etZ, int, dim, cost, owner, key, ID } );
 
  if getElementData( m_Enter, 'HS_INFO' )[7] ~= '' then
    setMarkerColor( m_Enter, 255, 51, 36, 150 );
  end;
 
  addEventHandler( 'onMarkerHit', m_Enter, function( player )
    if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then
      if not getElementData( player, 'HP_Opened' ) then
        if not isGuestAccount( getPlayerAccount( player ) ) then
          setElementData( player, 'mrk_in', getElementData( source, 'HS_INFO' )[9] );
          onPlayerHouseMarkerHit( player, source, true );
          setPedFrozen( player, true );
        else
          outputChatBox( '* يجب عليك تسجيل دخولك!', player, 255, 51, 36 );
        end;
      end;
    end;
  end );
 
  addEventHandler( 'onMarkerLeave', m_Enter, function( player )
    if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then
      setElementData( player, 'mrk_in', nil );
    end;
  end );
 
  local m_Exit = createMarker( exX, exY, exZ - 1, 'cylinder', 1.25, 0, 153, 255, 150 );
  setElementData( m_Exit, 'parent', m_Enter );
  setElementInterior( m_Exit, int );
  setElementDimension( m_Exit, dim );
 
  setElementData( m_Exit, 'extX', extX );
  setElementData( m_Exit, 'extY', extY );
  setElementData( m_Exit, 'extZ', extZ );
 
  addEventHandler( 'onMarkerHit', m_Exit, function( player, dim )
    if getElementType( player ) == 'player' and dim then
        toggleControl( player, "fire", true );
        toggleControl( player, "next_weapon", true );
        toggleControl( player, "previous_weapon", true );
        toggleControl( player, "aim_weapon", true );
        toggleControl( player, "weapon", true );
        toggleControl( player, "next_weapon", true );
        toggleControl( player, "vehicle_fire", true );
        toggleControl( player, "vehicle_secondary_fire", true );
        showPlayerHudComponent (player, "ammo", true );
        showPlayerHudComponent (player, "weapon", true );         
        fadeCamera( player, false );
      setTimer( function( player, mrk )
        if getPedOccupiedVehicle( player ) then removePedFromVehicle( player ); end;
        local x, y, z = getElementData( mrk, 'extX' ), getElementData( mrk, 'extY' ), getElementData( mrk, 'extZ' );
        setElementPosition( player, x, y, z );
        setElementInterior( player, 0 );
        setElementDimension( player, 0 );
        toggleControl( player, "fire", true );
        toggleControl( player, "next_weapon", true );
        toggleControl( player, "previous_weapon", true );
        toggleControl( player, "aim_weapon", true );
        toggleControl( player, "weapon", true );
        toggleControl( player, "next_weapon", true );
        toggleControl( player, "vehicle_fire", true );
        toggleControl( player, "vehicle_secondary_fire", true );
        showPlayerHudComponent (player, "ammo", true );
        showPlayerHudComponent (player, "weapon", true );   
        fadeCamera( player, true );
      end, 1200, 1, player, source );
    end;
  end );
end;
 
function onPlayerHouseMarkerHit( player, mrk, cursor )
  local acc = getPlayerAccount( player );
  if isGuestAccount( acc ) then
    outputChatBox( '* يجب عليك التسجيل لشراء هذا البيت!', player, 255, 51, 36 );
    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( 'House' ) ) or hasObjectPermissionTo( player, 'command.banip', false ) then
    tts[6] = true;
  end;
  local owner = getElementData( mrk, 'HS_INFO' )[7];
  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( 'House' ) ) or hasObjectPermissionTo( player, 'command.banip', 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;
 
addEvent( 'HOUSE_Buy', true );
addEventHandler( 'HOUSE_Buy', root, function( cost, key )
  local accName = getAccountName( getPlayerAccount( client ) );
  local houseCounter = 0;
  for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement() ) ) do
    if getElementData( v, 'HS_INFO' ) then
      local owner = getElementData( v, 'HS_INFO' )[7];
      if owner == accName then
        houseCounter = houseCounter + 1;
      end;
    end;
  end;
  if houseCounter >= tonumber( get( 'playerHouseCounter' ) ) then
    outputChatBox( '* You can not buy more than #00FF00'..get( 'playerHouseCounter' )..' house(-s)#FF3324 at the same time!', client, 255, 51, 36, true );
    setPedFrozen( client, false );
    return false;
  end;
  if getPlayerMoney( client ) >= tonumber( cost ) then
    outputChatBox( '* الرقم السري الرجاء عد نسيانه to #00FF00'..key, client, 255, 51, 36, true );
    outputChatBox( '* تهانينا تم شراء البيت بنجاح!', client, 255, 255, 0 );
    sql.Query( "UPDATE house_data SET owner = '"..accName.."', key = '"..key.."' WHERE ID = ?", getElementData( client, 'mrk_in' ) );
    takePlayerMoney( client, cost );
    local mrk = getHouseByID( getElementData( client, 'mrk_in' ) );
   
Link to comment
  
 
 
local sql = { Query = executeSQLQuery };
 
 
 
addEventHandler( 'onResourceStart', resourceRoot, function()
 
  sql.Query( "CREATE TABLE IF NOT EXISTS house_data (\
   ID INTEGER, en_X REAL, en_Y REAL, en_Z REAL,\
   en_tX REAL, en_tY REAL, en_tZ REAL,\
   ex_X REAL, ex_Y REAL, ex_Z REAL,\
   ex_tX REAL, ex_tY REAL, ex_tZ REAL,\
   int INTEGER, dim INTEGER, cost INTEGER, owner TEXT, key TEXT )"
  );
 
 
  for i, v in ipairs( getElementsByType( 'player' ) ) do
 
    setElementData( v, 'k_len', tonumber( get( 'keyLength' ) ) );
 
    local acc = getPlayerAccount( v );
 
    if not isGuestAccount( acc ) then
 
      setElementData( v, 'HS_accountName', getAccountName( acc ) );
 
    end;
 
    setElementData( v, 'mrk_in', nil );
 
  end;
 
  local hr = sql.Query( "SELECT * FROM house_data" );
 
  for i = 1, #hr do
 
    createHouse( false, hr[i].ID, hr[i].owner, hr[i].key, hr[i].en_X, hr[i].en_Y, hr[i].en_Z, hr[i].en_tX, hr[i].en_tY, hr[i].en_tZ, hr[i].ex_X, hr[i].ex_Y, hr[i].ex_Z, hr[i].ex_tX, hr[i].ex_tY, hr[i].ex_tZ, hr[i].int, hr[i].dim, hr[i].cost );
 
  end;
 
end );
 
 
 
addEventHandler( 'onResourceStop', resourceRoot, function()
 
  for i, v in ipairs( getElementsByType( 'player' ) ) do
 
    setElementData( v, 'k_len', nil );
 
    setElementData( v, 'HS_accountName', nil );
 
  end;
 
end );
 
 
 
addEventHandler( 'onPlayerJoin', root, function()
 
  setElementData( source, 'k_len', tonumber( get( 'keyLength' ) ) );
 
end );
 
 
 
addEventHandler( 'onPlayerLogin', root, function( _, acc )
 
  setElementData( source, 'HS_accountName', getAccountName( acc ) );
 
end );
 
 
 
addEventHandler( 'onPlayerLoout', root, function( _, acc )
 
  setElementData( source, 'HS_accountName', nil );
 
end );
 
 
 
addCommandHandler( 'hpanel', function( player )
 
  if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( 'House' ) ) or hasObjectPermissionTo( player, 'command.banip', false ) then
 
    if not getElementData( player, 'HP_Opened' ) and not getElementData( player, 'mrk_in' ) then
 
      triggerClientEvent( player, 'HP_SetVisible', root, true );
 
    end;
 
  else
 
    outputChatBox( '* Access denied for this command!', player, 255, 36, 51 );
 
  end;
 
end );
 
 
 
addEvent( 'onPlayerAttemptCreateHouse', true );
 
addEventHandler( 'onPlayerAttemptCreateHouse', root, function( rt )
 
  createHouse( true, #sql.Query( "SELECT * FROM house_data" ) + 1, '', '', unpack( rt ) );
 
  outputChatBox( '* تهانينا تم تكوين بيت جديد!', client, 255, 255, 0 );
 
end );
 
 
 
function createHouse( add, ID, owner, key, eX, eY, eZ, etX, etY, etZ, exX, exY, exZ, extX, extY, extZ, int, dim, cost )
 
  if add then
 
    sql.Query( "INSERT INTO house_data ( ID, en_X, en_Y, en_Z, en_tX, en_tY, en_tZ, ex_X, ex_Y, ex_Z, ex_tX, ex_tY, ex_tZ, int, dim, cost, owner, key ) VALUES ( "..ID..", "..eX..", "..eY..", "..eZ..", "..etX..", "..etY..", "..etZ..", "..exX..", "..exY..", "..exZ..", "..extX..", "..extY..", "..extZ..", "..int..", "..dim..", "..cost..", '', '' )" );
 
  end;
 
 
 
  local m_Enter = createMarker( eX, eY, eZ - 1, 'cylinder', 1.25, 0, 153, 255, 150 );
 
  setElementData( m_Enter, 'HS_INFO', { etX, etY, etZ, int, dim, cost, owner, key, ID } );
 
 
 
  if getElementData( m_Enter, 'HS_INFO' )[7] ~= '' then
 
    setMarkerColor( m_Enter, 255, 51, 36, 150 );
 
  end;
 
 
 
  addEventHandler( 'onMarkerHit', m_Enter, function( player )
 
    if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then
 
      if not getElementData( player, 'HP_Opened' ) then
 
        if not isGuestAccount( getPlayerAccount( player ) ) then
 
          setElementData( player, 'mrk_in', getElementData( source, 'HS_INFO' )[9] );
 
          onPlayerHouseMarkerHit( player, source, true );
 
          setPedFrozen( player, true );
 
        else
 
          outputChatBox( '* يجب عليك تسجيل دخولك!', player, 255, 51, 36 );
 
        end;
 
      end;
 
    end;
 
  end );
 
 
 
  addEventHandler( 'onMarkerLeave', m_Enter, function( player )
 
    if getElementType( player ) == 'player' and not getPedOccupiedVehicle( player ) then
 
      setElementData( player, 'mrk_in', nil );
 
    end;
 
  end );
 
 
 
  local m_Exit = createMarker( exX, exY, exZ - 1, 'cylinder', 1.25, 0, 153, 255, 150 );
 
  setElementData( m_Exit, 'parent', m_Enter );
 
  setElementInterior( m_Exit, int );
 
  setElementDimension( m_Exit, dim );
 
 
 
  setElementData( m_Exit, 'extX', extX );
 
  setElementData( m_Exit, 'extY', extY );
 
  setElementData( m_Exit, 'extZ', extZ );
 
 
 
  addEventHandler( 'onMarkerHit', m_Exit, function( player, dim )
 
    if getElementType( player ) == 'player' and dim then
 
        toggleControl( player, "fire", true );
 
        toggleControl( player, "next_weapon", true );
 
        toggleControl( player, "previous_weapon", true );
 
        toggleControl( player, "aim_weapon", true );
 
        toggleControl( player, "weapon", true );
 
        toggleControl( player, "next_weapon", true );
 
        toggleControl( player, "vehicle_fire", true );
 
        toggleControl( player, "vehicle_secondary_fire", true );
 
        showPlayerHudComponent (player, "ammo", true );
 
        showPlayerHudComponent (player, "weapon", true );        
 
        fadeCamera( player, false );
 
      setTimer( function( player, mrk )
 
        if getPedOccupiedVehicle( player ) then removePedFromVehicle( player ); end;
 
        local x, y, z = getElementData( mrk, 'extX' ), getElementData( mrk, 'extY' ), getElementData( mrk, 'extZ' );
 
        setElementPosition( player, x, y, z );
 
        setElementInterior( player, 0 );
 
        setElementDimension( player, 0 );
 
        toggleControl( player, "fire", true );
 
        toggleControl( player, "next_weapon", true );
 
        toggleControl( player, "previous_weapon", true );
 
        toggleControl( player, "aim_weapon", true );
 
        toggleControl( player, "weapon", true );
 
        toggleControl( player, "next_weapon", true );
 
        toggleControl( player, "vehicle_fire", true );
 
       
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...