Jump to content

[Solved] Tables & Double Click


Recommended Posts

سلام عليكم ورحمة الله وبركاته

ياجماعة انا عندي جدول كذا اوك ؟

Teleporting = {  
["الاماكن الرئسية"] = {  
["الدائري"] = {x,y,z}, 
}, 
} 
  

انا ابي مثال لو ظغط كلك يمين على الرو حق الاماكن الرئسية

يجيب لي احداثيات الدائري

كيف ؟؟ :redhotevil:

Edited by Guest
Link to comment

@#ZA7F //=

يعطيك العافيه . سويت الطريقة ونجحت

addEventHandler("onClientGUIDoubleClick",resourceRoot, function ( ) 
if ( source == GridList ) then 
local Selectort = guiGridListGetSelectedItem ( source ) 
if ( Selectort ~= -1 ) then  
if ( guiGridListGetItemText ( source , Selectort , 1 ) == "..." ) then  
guiGridListClear ( GridList ) 
for index,values in pairs ( Teleporting ) do  
local row = guiGridListAddRow ( GridList ) 
guiGridListSetItemText ( GridList , row , 1 , tostring ( index ) , false , false ) 
end 
else 
local Text = guiGridListGetItemText ( source , Selectort , 1 ) 
for index,v in pairs ( Teleporting[Text] ) do  
guiGridListClear ( source ) 
guiGridListSetItemText ( source , guiGridListAddRow ( source ) , 1 ,"..." , false , false ) 
local row = guiGridListAddRow ( source ) 
guiGridListSetItemText ( source , row , 1 , tostring ( index ) , false , false ) 
end 
end 
end 
end 
end 
) 
  

نأقص شي واحد بس :

الي هو لو اظغط على الدائري مثلأ

يجي خطأ بالدي بوق بـ table الي هو السطر ذا

for index,v in pairs ( Teleporting[Text] ) do  

ماعندي طريقة عشان اسويها

ياليت لو عندك طريقة قولي

Link to comment
Teleporting = {  
["الاماكن الرئسية"] = {  
["الدائري"] = {0,0,2}, 
}, 
} 
  
  
function RefreshGridList ( ) 
guiGridListClear ( GridList ) 
for index,values in pairs ( Teleporting ) do  
local row = guiGridListAddRow ( GridList ) 
guiGridListSetItemText ( GridList , row , 1 , tostring ( index ) , false , false ) 
end 
end 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        Window = guiCreateWindow(253, 116, 333, 379, "Teleport", false) 
        guiWindowSetSizable(Window, false) 
        guiSetAlpha(Window, 1.00) 
        guiSetProperty(Window, "CaptionColour", "FF00FF00") 
        GridList = guiCreateGridList(9, 34, 314, 324, false, Window) 
        guiGridListAddColumn(GridList, "Places :", 0.9)   
        RefreshGridList ( )      
        showCursor ( true ) 
    end 
) 
  
addEventHandler("onClientGUIDoubleClick",resourceRoot, function ( ) 
if ( source == GridList ) then 
local Selectort = guiGridListGetSelectedItem ( source ) 
if ( Selectort ~= -1 ) then  
if ( guiGridListGetItemText ( source , Selectort , 1 ) == "..." ) then  
RefreshGridList ( ) 
else 
local Text = guiGridListGetItemText ( source , Selectort , 1 ) 
for index,v in pairs ( Teleporting[Text] ) do  
guiGridListClear ( source ) 
guiGridListSetItemText ( source , guiGridListAddRow ( source ) , 1 ,"..." , false , false ) 
local row = guiGridListAddRow ( source ) 
guiGridListSetItemText ( source , row , 1 , tostring ( index ) , false , false ) 
end 
end 
end 
end 
end 
) 
  

ابي لو ظغط على الاماكن الرئيسة

يجيب الاماكن الي داخل الجدول

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

الي هي الدائري

بس ماعندي طريقة لو ظغط على الدائري ينقله للاحداثيات الي بالجدول

توضيح :

http://prntscr.com/bnnric

http://prntscr.com/bnnrno

Link to comment

جرب كذا .. :

local section_ = "" 
  
addEventHandler ( "onClientGUIDoubleClick", resourceRoot, function ( ) 
   if ( source == GridList ) then 
    local Selectort = guiGridListGetSelectedItem ( source ) 
    if ( Selectort ~= -1 ) then 
     if ( guiGridListGetItemText ( source, Selectort, 1 ) == "..." ) then 
          RefreshGridList ( ) 
          section_ = "" 
  else 
       if ( section_ == "" ) then 
          local Text = guiGridListGetItemText ( source, Selectort , 1 ) 
          guiGridListClear ( source ) 
          guiGridListSetItemText ( source, guiGridListAddRow ( source ) , 1 , "..." , false, false ) 
          for index,v in pairs ( Teleporting[Text] ) do 
          Row = guiGridListAddRow ( source ) 
          guiGridListSetItemText ( source, Row , 1 , index , false , false ) 
          end 
          section_ = Text 
     else   
          local p_ = guiGridListGetItemText ( source, Selectort , 1 ) 
          local PosTable = Teleporting[section_][p] 
          setElementPosition ( localPlayer, unpack(PosTable) ) 
      end 
     end 
   end 
  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...