Jump to content

طلب


z24d

Recommended Posts

السلام عليكم

وش المشكلة بالكود ووش طريقت حلها : |

local screenW, screenH = guiGetScreenSize() 
        wnd = guiCreateWindow(screenW - 167 - 10, (screenH - 205) / 2, 167, 205, "", false) 
        guiWindowSetSizable(wnd, false) 
        gridlist = guiCreateGridList(9, 21, 148, 141, false, wnd) 
        guiGridListAddColumn(gridlist, "#", 0.9) 
        btn = guiCreateButton(10, 172, 147, 23, "Close", false, wnd) 
        guiSetProperty(btn, "NormalTextColour", "FFAAAAAA")     
addEventHandler("onClientGUIClick",btn, 
function() 
guiSetVisible(wnd,false) 
end 
) 
         
Helps = { 
{"Health",100}, 
{"Armour",100} 
} 
  
for Master,Monster in ipairs(Helps) do 
row = guiGridListAddRow(gridlist)  
guiGridListSetItemText(gridlist,row,1,Monster[1],false,false) 
end 
  
addEventHandler("onClientGUIDoubleClick",root, 
        function() 
        if source == gridlist then 
if guiGridListGetItemText(gridlist,row,1) == "Armour" then 
triggerServerEvent("giveHimArm",localPlayer) 
end 
end 
end 
) 
  
addEventHandler("onClientGUIDoubleClick",root, 
        function() 
        if source == gridlist then 
if guiGridListGetItemText(gridlist,row,1) == "Health" then 
setElementHealth(localPlayer,100) 
end 
end 
end 
) 

سيرفر

addEvent("giveHimArm",true) 
addEventHandler("giveHimArm",root, 
        function() 
        setPedArmor(source,100) 
        end 
) 
         

Link to comment

تجيب لك الكلام مو تجيب لك الشي المحدد guiGridListGetItemText وظيفة

اذا تبي تحصل على الشي المحدد استخدم الوظيفة التالية

guiGridListGetSelectedItem 

الاول استخدم التحقق التالي row وعشان تتحقق انه محدد الـ

if guiGridListGetSelectedItem(gridlist) == 0 then 

Link to comment

Client

local screenW, screenH = guiGetScreenSize() 
wnd = guiCreateWindow(screenW - 167 - 10, (screenH - 205) / 2, 167, 205, "", false) 
guiWindowSetSizable(wnd, false) 
gridlist = guiCreateGridList(9, 21, 148, 141, false, wnd) 
guiGridListAddColumn(gridlist, "#", 0.9) 
btn = guiCreateButton(10, 172, 147, 23, "Close", false, wnd) 
guiSetProperty(btn, "NormalTextColour", "FFAAAAAA")     
  
addEventHandler("onClientGUIClick", btn, function() guiSetVisible(wnd,false) end); 
  
Helps = { 
    {"Health",100}, 
    {"Armour",100} 
}; 
  
for Master,Monster in ipairs(Helps) do 
    guiGridListSetItemText(gridlist,guiGridListAddRow(gridlist),1,Monster[1],false,false) 
end 
  
addEventHandler("onClientGUIDoubleClick", gridlist, 
function() 
    if guiGridListGetSelectedItem(source) ~= -1 then 
        if guiGridListGetItemText(source,guiGridListGetSelectedItem(source),1) == "Armour" then 
            triggerServerEvent("giveHimArm",localPlayer) 
        elseif guiGridListGetItemText(source,guiGridListGetSelectedItem(source),1) == "Health" then 
            setElementHealth(localPlayer,100) 
        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...