Jump to content

# مساعدة


Recommended Posts

سلآم عليكم في عندي كود مش عارف له 

 

addEvent ( 'Package:addPackagesToGridList', true )
addEventHandler ( 'Package:addPackagesToGridList', root,
function ( packages )
if source == ButtonOpen then end
    if packages then
        guiGridListClear ( gridlist_window )
        for i,v in ipairs ( packages ) do
            local row = guiGridListAddRow ( gridlist_window )
            local type
            if v['number'] == 1 then
                type = 'Gold'
            elseif v['number'] == 2 then
                type = 'Silver'
            elseif v['number'] == 3 then
                type = 'Bronze'
            end
            guiGridListSetItemText ( gridlist_window, row, 1, tostring ( type ), false, false )
            guiGridListSetItemText ( gridlist_window, row, 2, tostring ( v['ammount'] ), false, false )
            guiGridListSetItemData ( gridlist_window, row, 1, tostring ( v['number'] ) )
        end
    end
end)  

انا مسوي له ترايقر سيرفر :

 

addEvent ( 'Package:getMyPackages', true )
addEventHandler ( 'Package:getMyPackages', root,
function (package, ammount)
    if package then
        if package == 4 then package = math.random ( 1, 3 ) end
        local _type
        if package == 1 then
            _type = 'Gold'
        elseif package == 2 then
            _type = 'Silver'
        elseif package == 3 then
            _type = 'Bronze'
        end
    local account = getAccountName ( getPlayerAccount ( source ) )
    local result = dbPoll(dbQuery(db, "SELECT * FROM Packages WHERE account = ?", account), -1)
    if type(result) == "table" and #result ~= 0 and result[1]["account"] == account and tonumber ( result[1]["ammount"] ) > 0 then
        triggerClientEvent ( source, 'Package:addPackagesToGridList', source, result )
            else
            dbExec ( db, "INSERT INTO Packages VALUES (?,?,?)", account, package, ammount)
            outPut ( ammount.." of Lucky ".._type.." package has been added to your inventory.", source )
        end
	end
end)

وش المشكله فيه ؟
 

addEvent ( 'Package:Random', true )
addEventHandler ( 'Package:Random', root,
function ()
    if sound then return end
    img = "img/pack.png"
    addEventHandler("onClientRender", root, render)
    sound = playSound ( 'sound.mp3' )
    setTimer (
        function ()
            local rnd = math.random ( 100 )
            if rnd > 80 and rnd < 100 then
                if isElement ( sound ) then destroyElement ( sound ) end
                pack = 1
                img = "img/lucky"..pack..".png"
                sound = playSound ( 'sound2.mp3' )
                setTimer ( function () if isElement ( sound ) then destroyElement ( sound ) end end, 2000, 1 )
            elseif rnd >= 1 and rnd <= 40 then
                if isElement ( sound ) then destroyElement ( sound ) end
                pack = 2
                img = "img/lucky"..pack..".png"
                sound = playSound ( 'sound2.mp3' )
                setTimer ( function () if isElement ( sound ) then destroyElement ( sound ) end end, 2000, 1 )
            else
                if isElement ( sound ) then destroyElement ( sound ) end
                pack = 3
                img = "img/lucky"..pack..".png"
                sound = playSound ( 'sound2.mp3' )
                setTimer ( function () if isElement ( sound ) then destroyElement ( sound ) end end, 2000, 1 )
            end
            setTimer(function() removeEventHandler("onClientRender", root, render) sound = nil end, 3000, 1) 
        --    triggerServerEvent ( 'Package:givePlayerPackage', localPlayer, pack, 1 )
			triggerServerEvent ( 'Package:getMyPackages', localPlayer, pack, 1 )
        end
    ,6000, 1 )
end)

ابي رد :]

ليش ما ينضاف في قريد ليست ؟

Edited by DmAr511
Link to comment

شباب خلاص حليته , 

طيب دلحين ابي احول القريد ليست لـ dgs < 

الاكواد , 

addEventHandler ( 'onClientGUIClick', resourceRoot,
function (button, state)
    if button == "left" and state == "up" then
        if _bug then 
            return 'Stuuuuuupid :Pp' 
        end
        if source == wnd.close then
            guiSetVisible ( wnd.main, false )
            showCursor ( false )
        elseif source == wnd.open then
            if ( guiGridListGetSelectedItem ( wnd.grid ) ~= -1 ) then 
            local ammount = tonumber ( guiGridListGetItemText ( wnd.grid, guiGridListGetSelectedItem ( wnd.grid ), 2 ) )
                if ammount > 1 then
                    triggerServerEvent ( 'Package:openPack', localPlayer, guiGridListGetItemData ( wnd.grid, guiGridListGetSelectedItem ( wnd.grid ), 1 ) )
                    guiGridListSetItemText ( wnd.grid, guiGridListGetSelectedItem ( wnd.grid ), 2, tostring ( ammount - 1 ), false, false )
                else
                    triggerServerEvent ( 'Package:openPack', localPlayer, guiGridListGetItemData ( wnd.grid, guiGridListGetSelectedItem ( wnd.grid ), 1 ) )
                    guiGridListRemoveRow ( wnd.grid, guiGridListGetSelectedItem ( wnd.grid ) )
                end
                guiSetEnabled ( wnd.open, false )
                setTimer ( guiSetEnabled, 5000, 1, wnd.open, true )
            end
        elseif source == wnd.grid then
            local id = guiGridListGetItemData ( wnd.grid, guiGridListGetSelectedItem ( wnd.grid ), 1 )
            if id and (fileExists("img/lucky"..id..".png")) then
                guiStaticImageLoadImage(wnd.pack, "img/lucky"..id..".png")
            else
                guiStaticImageLoadImage(wnd.pack, "img/pack.png")
            end
        end
    end
end)

 

Link to comment

 

function WeatherAdd()
local selectaData = DGS:dgsComboBoxGetSelected ( WeatherB )
if selectaData ~= -1 then
local weather = DGS:dgsComboBoxGetItemText(WeatherB, selectaData)
setWeather(weather)
for index,value in pairs(Weather) do
exports.dgs:dgsComboBoxAddItem(WeatherB,index) end
else
exports["guimessages"]:outputClient("#FFAA00[User Panel] :#FF0000 Error - Select a Weather", 255, 0, 0)
end
end
addEventHandler("onDgsComboBoxSelect",getRootElement(),WeatherAdd)

وش الخرب فيه :

Edited by N3xT
Link to comment
8 hours ago, DmAr511 said:

ابي اقلد عندك شي ؟ 

وش الخرب فيه 


function WeatherAdd()
local selectaData = DGS:dgsComboBoxGetSelected ( WeatherB )
if selectaData ~= -1 then
local weather = DGS:dgsComboBoxGetItemText(WeatherB, selectaData)
setWeather(weather)
for index,value in pairs(Weather) do
exports.dgs:dgsComboBoxAddItem(WeatherB,index) end
else
exports["guimessages"]:outputClient("#FFAA00[User Panel] :#FF0000 Error - Select a Weather", 255, 0, 0)
end
end
addEventHandler("onDgsComboBoxSelect",getRootElement(),WeatherAdd)

وش الخرب فيه :

بالبداية المفروض تسوي كذا

if selectedData == -1 then

لان الي مسويه انت لو مامختار شيء من الكومبو بوكس وهو العكس

ثانياً شنو هي مشكلتك

و الويثر تسويه بالايدي مو بالاسم

 

  • weatherID: The ID of new weather. Valid values are 0 to 255 inclusive.
Edited by N3xT
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...