Recommended Posts

/

Edited by Optiks

Share this post


Link to post

Hello! Could you add something like css border-radius property? It'll be awesome having rounded buttons, window, gridlist corners

Share this post


Link to post
6 hours ago, JeViCo said:

Hello! Could you add something like css border-radius property? It'll be awesome having rounded buttons, window, gridlist corners

This requires shader

Share this post


Link to post
5 hours ago, thisdp said:

This requires shader

that's sad :c 

Share this post


Link to post
2 hours ago, JeViCo said:

that's sad :c 

dx function is still limited compared with html

Share this post


Link to post

@thisdp Hello again) Could you help me?

function scr(new, old)
	if source == dgsGridListGetScrollBar(gridlist)[1] then
		dgsGridListSetScrollPosition(gridlist,old)
	end
end
addEventHandler("onDgsScrollBarScrollPositionChange",root,scr)

i tried to make something like cancelEvent() but dgs resource gives an error: "C stack overflow"

  • Like 1

Share this post


Link to post

Hello. I have several problems on my server with this interface. I've updated the resource already with the command (/updatedgs) or re-uploading the downloaded files from GitHub.

 

When I'm clicking a button which has an handler ("onDgsMouseClick"), executes the function twice. Has anyone this problem like me? I'd like to resolve it.

 

exports.DGS:dgsCreateButton(301, 111, 481, 40, "Register", false, login[4], tocolor(255, 255, 255,255), false, false, false, false, false,  tocolor(240, 181, 0,255),  tocolor(0, 0, 0,255),  tocolor(240, 181, 0,255))

 

Thanks!

Regards,

@edge

Edited by edge

Share this post


Link to post
function scr(new, old)
	if source == dgsGridListGetScrollBar(gridlist)[1] then
		local vertical = dgsGridListGetScrollPosition(gridlist)
		if vertical ~= old then
			dgsGridListSetScrollPosition(gridlist,old)
		end
	end
end
addEventHandler("onDgsScrollBarScrollPositionChange",root,scr)

 

9 hours ago, edge said:

Hello. I have several problems on my server with this interface. I've updated the resource already with the command (/updatedgs) or re-uploading the downloaded files from GitHub.

 

When I'm clicking a button which has an handler ("onDgsMouseClick"), executes the function twice. Has anyone this problem like me? I'd like to resolve it.

 


exports.DGS:dgsCreateButton(301, 111, 481, 40, "Register", false, login[4], tocolor(255, 255, 255,255), false, false, false, false, false,  tocolor(240, 181, 0,255),  tocolor(0, 0, 0,255),  tocolor(240, 181, 0,255))

 

Thanks!

Regards,

@edge

https://wiki.multitheftauto.com/wiki/OnDgsMouseClick

read the bold text in "state" carefully

  • Like 1
  • Thanks 1

Share this post


Link to post

Also this code

f = addEventHandler("OnDgsGridListSelect",getRootElement(),chooseStickGrid)
print(f)

always returns false and of course chooseStickGrid function doesn't work. I tried to put gridlist variable instead of getRootElement() but got same result

:arcade:

and FINALLY gridlist sort "#"..number items like this and i can't understand how to fix it

RMazp7n9T6SuRTwvr3MCVQ.png

Edited by JeViCo

Share this post


Link to post
2 hours ago, JeViCo said:

Also this code


f = addEventHandler("OnDgsGridListSelect",getRootElement(),chooseStickGrid)
print(f)

always returns false and of course chooseStickGrid function doesn't work. I tried to put gridlist variable instead of getRootElement() but got same result

:arcade:

and FINALLY gridlist sort "#"..number items like this and i can't understand how to fix it

RMazp7n9T6SuRTwvr3MCVQ.png

Event Name: On*** -> on***

use custom sort function

  • Thanks 1

Share this post


Link to post
21 minutes ago, thisdp said:

Event Name: On*** -> on***

oops, my fault

22 minutes ago, thisdp said:

use custom sort function

i have some difficulties with it. 

I guess i'm totally wrong here

local sortfnc = [[
	local arg = {...}
	local a = arg[1]
	local b = arg[2]
	local column = dgsElementData[self].sortColumn
	local texta,textb = a[column][1],b[column][1]
	local texta,textb = tonumber(string.gsub(texta,"%#","")),tonumber(string.gsub(textb,"%#",""))
	return texta < textb
]]

 

Share this post


Link to post
23 minutes ago, JeViCo said:

oops, my fault

i have some difficulties with it. 

I guess i'm totally wrong here


local sortfnc = [[
	local arg = {...}
	local a = arg[1]
	local b = arg[2]
	local column = dgsElementData[self].sortColumn
	local texta,textb = a[column][1],b[column][1]
	local texta,textb = tonumber(string.gsub(texta,"%#","")),tonumber(string.gsub(textb,"%#",""))
	return texta < textb
]]

 

here is an example

	local sortfnc = [[
	local arg = {...}
	local a = arg[1]
	local b = arg[2]
	local column = dgsElementData[self].sortColumn
	local texta,textb = a[column][1],b[column][1]
	local texta,textb = tonumber(texta:sub(2)),tonumber(textb:sub(2))
	print(texta,textb)
	return texta < textb
	]]
	gridlist = dgsCreateGridList(300,50,600,600,false)
	dgsGridListAddColumn(gridlist,"test1",0.2)
	for i=1,50 do
		local row = dgsGridListAddRow(gridlist)
		dgsGridListSetItemText(gridlist,row,1,"#"..tostring(i))
	end
	dgsGridListSetSortEnabled(gridlist,false) --disable click sorting
	dgsGridListSetSortFunction(gridlist,sortfnc)
	dgsGridListSetSortColumn(gridlist,1)

 

5 hours ago, JeViCo said:

same

zcTHvol0RMuihj5i24a5xA.png

 

I have just released DGS 3.393

You can use dgsScrollBarSetLocked to lock the position

dgsScrollBarSetLocked(scrollbar,state)

Edited by thisdp
  • Thanks 1

Share this post


Link to post
23 minutes ago, thisdp said:

here is an example


	local sortfnc = [[
	local arg = {...}
	local a = arg[1]
	local b = arg[2]
	local column = dgsElementData[self].sortColumn
	local texta,textb = a[column][1],b[column][1]
	local texta,textb = tonumber(texta:sub(2)),tonumber(textb:sub(2))
	print(texta,textb)
	return texta < textb
	]]
	gridlist = dgsCreateGridList(300,50,600,600,false)
	dgsGridListAddColumn(gridlist,"test1",0.2)
	for i=1,50 do
		local row = dgsGridListAddRow(gridlist)
		dgsGridListSetItemText(gridlist,row,1,"#"..tostring(i))
	end
	dgsGridListSetSortEnabled(gridlist,false) --disable click sorting
	dgsGridListSetSortFunction(gridlist,sortfnc)
	dgsGridListSetSortColumn(gridlist,1)

 

click sorting confused me. Thank you

  • Like 1

Share this post


Link to post

Could you help me a little bit? (maybe not). Something wrong with my code - 3d menu always facing the wrong way

local x, y, z = getElementPosition ( localPlayer ) 
local _,_,r = getElementRotation ( localPlayer ) 
x = x - math.sin ( math.rad ( r ) ) * 2
y = y + math.cos ( math.rad ( r ) ) * 2

d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000)
w_main = dgsCreateWindow(0, 0, 0.32, 0.58, "test window", true)

6-MbOeUPTa_CXgiJpFWZ0g.png

BoqnTdadRSCFVea8-bzqrw.png

Share this post


Link to post
4 hours ago, JeViCo said:

Could you help me a little bit? (maybe not). Something wrong with my code - 3d menu always facing the wrong way


local x, y, z = getElementPosition ( localPlayer ) 
local _,_,r = getElementRotation ( localPlayer ) 
x = x - math.sin ( math.rad ( r ) ) * 2
y = y + math.cos ( math.rad ( r ) ) * 2

d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000)
w_main = dgsCreateWindow(0, 0, 0.32, 0.58, "test window", true)

6-MbOeUPTa_CXgiJpFWZ0g.png

BoqnTdadRSCFVea8-bzqrw.png

I just wonder how can you draw a window on 3d interface.

set face to nil,nil,nil can give you an always facing to the camera state

Edited by thisdp
  • Thanks 1

Share this post


Link to post
7 hours ago, thisdp said:

I just wonder how can you draw a window on 3d interface.

i cut that from my code. I forgot to add dgsSetParent

7 hours ago, thisdp said:

set face to nil,nil,nil can give you an always facing to the camera state

i tried to add coordinates from getCameraMatrix and getElementPosition - same. I'll try with nil,nil,nil

  • Like 1

Share this post


Link to post
9 hours ago, JeViCo said:

i cut that from my code. I forgot to add dgsSetParent

i tried to add coordinates from getCameraMatrix and getElementPosition - same. I'll try with nil,nil,nil

face to of dgs 3d interface is offset relative to the position of 3d interface

such as face to 1,0,0

the absolute position is x+1,y,z

Share this post


Link to post
44 minutes ago, thisdp said:

face to of dgs 3d interface is offset relative to the position of 3d interface

such as face to 1,0,0

the absolute position is x+1,y,z

i didn't know about that, thanks!

p.s. i've just tested those offsets and they don't work for me (at all)

addCommandHandler("ttt",function(cmd,amount)
	local x, y, z = getElementPosition ( localPlayer ) 
	local _,_,r = getElementRotation ( localPlayer ) 
	x = x - math.sin ( math.rad ( r ) ) * 2
	y = y + math.cos ( math.rad ( r ) ) * 2

	d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,tonumber(amount),r)
	w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false)
	dgsSetParent(w_main,d3)
end)

i thought i can rotate those menus using offsets and player rotation but all of them

adFwaLa7TMC3tjYMhmcNng.png

Could you add something like camera position settings then? 1. Menu always facing towards the player (dynamic world position) 2. Menu always facing towards the single point (static world position)

Edited by JeViCo

Share this post


Link to post
9 hours ago, JeViCo said:

i didn't know about that, thanks!

p.s. i've just tested those offsets and they don't work for me (at all)


addCommandHandler("ttt",function(cmd,amount)
	local x, y, z = getElementPosition ( localPlayer ) 
	local _,_,r = getElementRotation ( localPlayer ) 
	x = x - math.sin ( math.rad ( r ) ) * 2
	y = y + math.cos ( math.rad ( r ) ) * 2

	d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,tonumber(amount),r)
	w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false)
	dgsSetParent(w_main,d3)
end)

i thought i can rotate those menus using offsets and player rotation but all of them

adFwaLa7TMC3tjYMhmcNng.png

Could you add something like camera position settings then? 1. Menu always facing towards the player (dynamic world position) 2. Menu always facing towards the single point (static world position)

so I told you,  set "Face To" to nil,nil,nil

https://wiki.multitheftauto.com/wiki/DgsCreate3DInterface

If you want to face to a point, use pointPosition-3dInterfacePosition

Edited by thisdp

Share this post


Link to post
12 hours ago, thisdp said:

so I told you,  set "Face To" to nil,nil,nil

addCommandHandler("ttt",function()
	local x, y, z = getElementPosition ( localPlayer ) 
	local _,_,r = getElementRotation ( localPlayer ) 
	x = x - math.sin ( math.rad ( r ) ) * 2
	y = y + math.cos ( math.rad ( r ) ) * 2

	d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,nil,nil,nil)
	w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false)
	dgsSetParent(w_main,d3)
end)

](*,)

Share this post


Link to post
1 hour ago, JeViCo said:

addCommandHandler("ttt",function()
	local x, y, z = getElementPosition ( localPlayer ) 
	local _,_,r = getElementRotation ( localPlayer ) 
	x = x - math.sin ( math.rad ( r ) ) * 2
	y = y + math.cos ( math.rad ( r ) ) * 2

	d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,nil,nil,nil)
	w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false)
	dgsSetParent(w_main,d3)
end)

](*,)

dgsSetProperty(interface,"faceTo",{faceTowardsX,faceTowardsY,faceTowardsZ})

Share this post


Link to post
18 minutes ago, Daniels69 said:

dgsSetProperty(interface,"faceTo",{faceTowardsX,faceTowardsY,faceTowardsZ})

same

addCommandHandler("ttt",function()
	local x, y, z = getElementPosition ( localPlayer )
	local px,py,pz = x,y,z
	local _,_,r = getElementRotation ( localPlayer ) 
	x = x - math.sin ( math.rad ( r ) ) * 2
	y = y + math.cos ( math.rad ( r ) ) * 2

	d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,nil,nil,nil)
	w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false)
	dgsSetParent(w_main,d3)
	dgsSetProperty(d3,"faceTo",{px,py,pz})
end)

 

Share this post


Link to post
20 minutes ago, JeViCo said:

same


addCommandHandler("ttt",function()
	local x, y, z = getElementPosition ( localPlayer )
	local px,py,pz = x,y,z
	local _,_,r = getElementRotation ( localPlayer ) 
	x = x - math.sin ( math.rad ( r ) ) * 2
	y = y + math.cos ( math.rad ( r ) ) * 2

	d3 = dgsCreate3DInterface(x, y, z+1,2,2,512,512,0xFF000000,nil,nil,nil)
	w_main = dgsCreateWindow(0, 0, 100, 100, "test window", false)
	dgsSetParent(w_main,d3)
	dgsSetProperty(d3,"faceTo",{px,py,pz})
end)

 

sry, it's my fault, updatedgs

But it seems there is still a problem. I will fix it later :D

Thank you

  • Like 1

Share this post


Link to post

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.