Jump to content

[Solved] Tables & Double Click


Recommended Posts

Posted (edited)

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

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

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

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

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

كيف ؟؟ :redhotevil:

Edited by Guest
Posted
تجيب اللي اختارهـ من اللستة وتتصل بالتيبل وتجلبهم بسيطة جدا
guiGridListGetItemText 
guiGridListGetSelectedItem 

طيب اذا ما في رصيد هههههههههههههههه

Posted

@#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  

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

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

Posted
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

Posted

جرب كذا .. :

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 ) 
  

Posted

@#ZA7F //=

يعطيك الف عافيه اخوي زاحف ماقصرت والله

سطر 22 مو معرفة p انت نسيت تحط p_

بس عوافي

ظبط يعطيك الف عافيه

Posted
يب نسيت احط الشرطة

الله يعافيك ^

ولا الدفاع المدني

عهههههههههههههههههههه

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