Jump to content

Problem in code


Ayee

Recommended Posts

Posted
local sx,sy = guiGetScreenSize()

addEvent("onInventoryShowNeeded",true)
addEventHandler("onInventoryShowNeeded", root,
    function(items)
		if not isElement(invwdw) then
			invwdw = guiCreateWindow((sx - 291)/2,(sy - 445)/2, 291, 445, "GTE:RPG Inventory", false)
			guiWindowSetSizable(invwdw, false)

			logo = guiCreateStaticImage(70, 22, 149, 56, ":SAEGLogin/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("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)
Quote

its errors

ERROR: Server Triggered clientside event hideinventory,but event is not added clientside

ERROR: Server Triggered clientside event showinventory,but event is not added clientside

thanks for Read. if u can help please help me

Posted (edited)

Clientside events hideinventory and showinventory are missed. I don't see them in your code.

Edited by NeverUnbeatable
Posted
2 hours ago, NeverUnbeatable said:

Clientside events hideinventory and showinventory are missed. I don't see them in your code.

yes i think problem in them can u help me?

 

Posted (edited)

You need to add those events. If you can't do it yourself, there's no reason for you to be here, as we are not here to code for you.

Edited by MrTasty
Posted
3 hours ago, MrTasty said:

You need to add those events. If you can't do it yourself, there's no reason for you to be here, as we are not here to code for you.

im asking for help from Good One not from you i didnt ask  u for help then dont talk

  • Like 1
  • Moderators
Posted
4 hours ago, Maxman said:

im asking for help from Good One not from you i didnt ask  u for help then dont talk

You may haven't notice it, but you are making an unwanted request.

 

Please read the scripting section rules, to understand why this request is unwanted. Good luck with learning lua.

 

Posted (edited)

Problem is to easy to solve pls read the errors carefully it says you have not added server side functions go through serverside code again ,client side code is correct only issue on server side code :D !!

Edited by Khadeer143
  • 4 weeks later...
Posted
On 5/13/2018 at 04:44, Venon1 said:

Don't help him staffs he is using smug resources  stolen 

yea +1 he using SAUGInventory stolen no one help him plz

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