Jump to content

Help - Inventory


Tando

Recommended Posts

Posted (edited)

Hello everybody,

I Tired from Work in Inventory to Put DrugEffect/Drug Draw Time

As i know only @_DrXenon , @Oussema have inventory oF STORM/SAEG Client .lua May i get Help in it

May i get Help in DrugEffect/DrugDXDraw For Time here or get Full Inventory !

Client:


local sx,sy = guiGetScreenSize()

addEvent("Hiddeny",true)
addEventHandler("Hidden", root,
    function(items)
        if not isElement(invwdw) then
            invwdw = guiCreateWindow((sx - 291)/2,(sy - 445)/2, 291, 445, "SAUG Inventory", false)
            guiWindowSetSizable(invwdw, false)

            logo = guiCreateStaticImage(70, 22, 149, 56, ":SAUGLogin/logo.png", false, invwdw)
            invgrid = guiCreateGridList(9, 81, 273, 311, false, invwdw)
            guiGridListAddColumn(invgrid, "Item", 0.5)
            guiGridListAddColumn(invgrid, "Quantitiy", 0.5)
                for i,v in ipairs(items) do
                    row = guiGridListAddRow(invgrid)
                    guiGridListSetItemText(invgrid, row, 1, v["item"], false, false)
                    guiGridListSetItemText(invgrid, row, 2, v["quant"].." unit(s)", false, false)
                end
            closebtn = guiCreateButton(213, 396, 69, 39, "Close", false, invwdw)
            infolabel = guiCreateLabel(10, 396, 196, 36, "Double mouse 'Right' click to use!\nDouble mouse 'Left' click to drop!", false, invwdw)
            guiSetFont(infolabel, "default-bold-small")
            guiLabelSetHorizontalAlign(infolabel, "center", false)
            guiLabelSetVerticalAlign(infolabel, "center")    
        else
            destroyElement(invwdw)
        end
    end
)

addEventHandler("onClientGUIClick",root,function()
    if isElement(invwdw) then
        if source == closebtn then
            destroyElement(invwdw)
        end
    end
end)

addEventHandler("onClientGUIDoubleClick",root,function()
    if isElement(invwdw) then
        if source == invgrid then
            local sel = guiGridListGetSelectedItem(invgrid)
            local item = guiGridListGetItemText(invgrid,sel,1)
            local quan = guiGridListGetItemText(invgrid,sel,2)
            local quan = string.gsub(quan,"unit(s)","")
            local quan = tonumber(quan)
                triggerServerEvent("useItem",localPlayer,item)
        end
    end
end)

addEvent("updateInvGridList",true)
addEventHandler("updateInvGridList",root,function(items)
    if isElement(invwdw) then
            destroyElement(invgrid)
                --local items = getElementData(localPlayer,"inventoryitems")
                invgrid = guiCreateGridList(9, 81, 273, 311, false, invwdw)
                guiGridListAddColumn(invgrid, "Item", 0.5)
                guiGridListAddColumn(invgrid, "Quantitiy", 0.5)
                    for i,v in ipairs(items) do
                        row = guiGridListAddRow(invgrid)
                        guiGridListSetItemText(invgrid, row, 1, v["item"] or v[1], false, false)
                        guiGridListSetItemText(invgrid, row, 2, (v["quant"] or v[2]).." unit(s)", false, false)
                    end
    end
end)

 

Edited by CodyJ(L)
Fixed Lua
Posted
local sx,sy = guiGetScreenSize()

addEvent("Hiddeny",true)
addEventHandler("Hidden", root,
    function(items)
        if not isElement(invwdw) then
            invwdw = guiCreateWindow((sx - 291)/2,(sy - 445)/2, 291, 445, "SAUG Inventory", false)
            guiWindowSetSizable(invwdw, false)

            logo = guiCreateStaticImage(70, 22, 149, 56, ":SAUGLogin/logo.png", false, invwdw)
            invgrid = guiCreateGridList(9, 81, 273, 311, false, invwdw)
            guiGridListAddColumn(invgrid, "Item", 0.5)
            guiGridListAddColumn(invgrid, "Quantitiy", 0.5)
                for i,v in ipairs(items) do
                    row = guiGridListAddRow(invgrid)
                    guiGridListSetItemText(invgrid, row, 1, v["item"], false, false)
                    guiGridListSetItemText(invgrid, row, 2, v["quant"].." unit(s)", false, false)
                end
            closebtn = guiCreateButton(213, 396, 69, 39, "Close", false, invwdw)
            infolabel = guiCreateLabel(10, 396, 196, 36, "Double mouse 'Right' click to use!\nDouble mouse 'Left' click to drop!", false, invwdw)
            guiSetFont(infolabel, "default-bold-small")
            guiLabelSetHorizontalAlign(infolabel, "center", false)
            guiLabelSetVerticalAlign(infolabel, "center")    
        else
            destroyElement(invwdw)
        end
    end
)

addEventHandler("onClientGUIClick",root,function()
    if isElement(invwdw) then
        if source == closebtn then
            destroyElement(invwdw)
        end
    end
end)

addEventHandler("onClientGUIDoubleClick",root,function()
    if isElement(invwdw) then
        if source == invgrid then
            local sel = guiGridListGetSelectedItem(invgrid)
            local item = guiGridListGetItemText(invgrid,sel,1)
            local quan = guiGridListGetItemText(invgrid,sel,2)
            local quan = string.gsub(quan,"unit(s)","")
            local quan = tonumber(quan)
                triggerServerEvent("useItem",localPlayer,item)
        end
    end
end)

addEvent("updateInvGridList",true)
addEventHandler("updateInvGridList",root,function(items)
    if isElement(invwdw) then
            destroyElement(invgrid)
                --local items = getElementData(localPlayer,"inventoryitems")
                invgrid = guiCreateGridList(9, 81, 273, 311, false, invwdw)
                guiGridListAddColumn(invgrid, "Item", 0.5)
                guiGridListAddColumn(invgrid, "Quantitiy", 0.5)
                    for i,v in ipairs(items) do
                        row = guiGridListAddRow(invgrid)
                        guiGridListSetItemText(invgrid, row, 1, v["item"] or v[1], false, false)
                        guiGridListSetItemText(invgrid, row, 2, (v["quant"] or v[2]).." unit(s)", false, false)
                    end
    end
end)

 

Posted
14 hours ago, Khadeer143 said:

I can make you whole new system not clone of saeg or any servers if you can pay me xD

i can't pay :D

 

16 hours ago, mazen54 said:

Easy

 

if easy so where is it ?

Posted
On 6/3/2018 at 22:02, mazen54 said:

so why i have to say ?

ican do it in 10min only and ez

so do it lool

if you don't need to say so don't reply

  • 1 month later...
  • Moderators
Posted
On 8-6-2018 at 14:23, (SAUG)Tando said:

so do it lool

if you don't need to say so don't reply

It is the same for you. Don't post and reply here in the scripting section with code requests. Your post and replies are unwanted according to the section rules.

 

Before posting in this section, please read the rules and have a nice day or two.

 

 

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