Jump to content

طلب: لما اللاعب يضغط على ايتم بالقريدليست


Recommended Posts

السلام عليكم

سويت لوحة فيها قريدلست

ابية لما اضغط على رو محدد باللوحة يسوي فنكشن معينة بس للحين ماني لاقي الحدث :/

الكود:

اعرف ان نصة اخطاء بس المهم شغال لحد الأن :D

  
  
  
  
  
  
  
  
GUIEditor = { 
    gridlist = {}, 
    window = {}, 
    button = {} 
} 
  
  
  
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(441, 201, 440, 445, "CJ Cloths", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
        GUIEditor.gridlist[1] = guiCreateGridList(9, 22, 278, 409, false, GUIEditor.window[1]) 
        Column = guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.9) 
  
            Raw = guiGridListAddRow ( GUIEditor.gridlist[1] ) 
            guiGridListSetItemText ( GUIEditor.gridlist[1], Raw, Column,  tostring("Type0index0"), false  , false ) 
        SetB = guiCreateButton(299, 391, 131, 40, "Set", false, GUIEditor.window[1]) 
        ExitB = guiCreateButton(299, 316, 131, 40, "Exit", false, GUIEditor.window[1]) 
  
  
        trousersB = guiCreateButton(274, 64, 121, 37, "", false) 
        guiSetAlpha(trousersB, 0.00) 
  
  
        shirtsB = guiCreateButton(3, 64, 121, 37, "", false) 
        guiSetAlpha(shirtsB, 0.00) 
  
  
        shoesB = guiCreateButton(0, 111, 121, 37, "", false) 
        guiSetAlpha(shoesB, 0.00) 
  
  
        headsB = guiCreateButton(0, 158, 121, 37, "", false) 
        guiSetAlpha(headsB, 0.00) 
  
  
        glassesB = guiCreateButton(0, 205, 121, 37, "", false) 
        guiSetAlpha(glassesB, 0.00) 
  
  
        hatsB = guiCreateButton(275, 205, 121, 37, "", false) 
        guiSetAlpha(hatsB, 0.00) 
  
  
        watchesB = guiCreateButton(275, 158, 121, 37, "", false) 
        guiSetAlpha(watchesB, 0.00) 
  
  
        necklaceB = guiCreateButton(275, 111, 121, 37, "", false) 
        guiSetAlpha(necklaceB, 0.00) 
  
  
        extrasB = guiCreateButton(144, 215, 111, 37, "", false) 
        guiSetAlpha(extrasB, 0.00)     
  
        guiSetVisible( GUIEditor.window[1], false ) 
    end 
) 
  
  
function DXS() 
        dxDrawRectangle(0, 0, 400, 278, tocolor(0, 0, 0, 206), false) 
        dxDrawText("CJ Cloths", 3, 2, 400, 47, tocolor(255, 255, 0, 255), 1.00, "bankgothic", "center", "top", false, false, false, false, false) 
        dxDrawLine(0, 38, 400, 38, tocolor(255, 255, 255, 255), 2, false) 
        dxDrawText("Shirts", 10, 64, 120, 101, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("Trousers", 280, 64, 390, 101, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("Shoes", 10, 111, 120, 148, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("Necklace", 280, 111, 390, 148, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("Heads", 10, 158, 120, 195, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("Watches", 280, 158, 390, 195, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("Glasses", 10, 205, 120, 242, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("Hats", 280, 205, 390, 242, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("Extras", 145, 215, 255, 252, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", false, false, false, false, false) 
        dxDrawText("By: ", 126, 74, 164, 101, tocolor(0, 255, 0, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) 
        dxDrawText("Mr.Mouamle", 136, 101, 274, 128, tocolor(0, 0, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) 
end 
  
  
function Draw( path ) 
    local x = 297 
    local y = 26 
    local w = 133 
    local h = 245 
    guiCreateStaticImage (  x,  y,  w,  h, path, false, GUIEditor.window[1]) 
end 
  
  
bindKey("F9", "up",  
    function() 
  
        addEventHandler("onClientRender", root, DXS) 
        showCursor( true ) 
  
    end 
) 
  
addEventHandler( "onClientGUIClick", root,  
    function() 
        if ( source == ExitB ) then 
            guiSetVisible( GUIEditor.window[1] , false ) 
            showCursor( false ) 
            removeEventHandler("onClientRender", root, DXS) 
        elseif ( source == shirtsB ) then 
                    guiSetVisible( GUIEditor.window[1], true ) 
                    showCursor( true ) 
                      
  
        elseif ( source == SetB ) then 
               Draw("Shirts/Type0index0.png") 
         
         
         end 
    end 
)   
  
  
  
  
  

Link to comment

سويت لك مثال تحدد اسم اللاعب وتحطه فى ليبل

  
local sx,sy = guiGetScreenSize() 
window = guiCreateWindow((sx - 262) / 2, (sy - 244) / 2, 262, 244, "Players window", false) 
guiWindowSetSizable(window, false) 
gridlist = guiCreateGridList(9, 23, 243, 141, false, window) 
guiGridListAddColumn(gridlist, "players ...", 0.9) 
label = guiCreateLabel(9, 166, 243, 26, "", false, window) 
button = guiCreateButton(15, 198, 227, 34, "ok", false, window) 
-- Loop 
for _, v in ipairs(getElementsByType("player")) do  
local row = guiGridListAddRow (gridlist) 
local r, g, b = getPlayerNametagColor (v) 
guiGridListSetItemText (gridlist, row,1, getPlayerName(v):gsub("#%x%x%x%x%x%x",""), false, false ) 
guiGridListSetItemColor (gridlist, row,1, r, g, b ) 
end 
-- Event 
addEventHandler ( "onClientGUIClick",button, 
function  () 
if guiGridListGetSelectedItem(gridlist) ~= -1 then 
local playerName = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 1 ) 
guiSetText (label,playerName ) 
else 
guiSetText (label,[[select the name of the players]]) 
end 
end,false) 
  

Link to comment
سويت لك مثال تحدد اسم اللاعب وتحطه فى ليبل
  
local sx,sy = guiGetScreenSize() 
window = guiCreateWindow((sx - 262) / 2, (sy - 244) / 2, 262, 244, "Players window", false) 
guiWindowSetSizable(window, false) 
gridlist = guiCreateGridList(9, 23, 243, 141, false, window) 
guiGridListAddColumn(gridlist, "players ...", 0.9) 
label = guiCreateLabel(9, 166, 243, 26, "", false, window) 
button = guiCreateButton(15, 198, 227, 34, "ok", false, window) 
-- Loop 
for _, v in ipairs(getElementsByType("player")) do  
local row = guiGridListAddRow (gridlist) 
local r, g, b = getPlayerNametagColor (v) 
guiGridListSetItemText (gridlist, row,1, getPlayerName(v):gsub("#%x%x%x%x%x%x",""), false, false ) 
guiGridListSetItemColor (gridlist, row,1, r, g, b ) 
end 
-- Event 
addEventHandler ( "onClientGUIClick",button, 
function  () 
if guiGridListGetSelectedItem(gridlist) ~= -1 then 
local playerName = guiGridListGetItemText (gridlist, guiGridListGetSelectedItem (gridlist), 1 ) 
guiSetText (label,playerName ) 
else 
guiSetText (label,[[select the name of the players]]) 
end 
end,false) 
  

مشكور :)

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