Jump to content

Recommended Posts

  • Scripting Moderators
23 minutes ago, Fact55 said:

It seems to them that they do not exist

OK. I think it is fixed. plz update dgs with "updatedgs".

Link to comment
  • Scripting Moderators
On 2017/7/11 at 18:46, Axel said:

Can you not do smething like this: 

 


local nr = 8
function formatString( text ) -- function to format the entire text into a table
	if string.len(text) > nr then
		return string.sub(text, 1, nr-1), formatString( string.sub(text, nr) )
	else
		return text
	end
end

local testText = "we are testing here something, if it makes our table"
local textTable = { formatString(testText) }

And then just use the table in your code?

If the code works more efficiently, I can continue to finish the memo.

function getTextIndexFromPosition(text,font,position)
	local pos = 0
	for i=1,utf8.len(text) do
		local t = utf8.sub(text,i,i)
		local p = dxGetTextWidth(t,font)
		if position < pos+0.5*p then
			return index-1
		elseif position < pos+p then
			return index
		end
		pos = pos+p
	end
	return false
end

 

Link to comment
  • Scripting Moderators
8 hours ago, Hamatora said:

Well, dgsDxGridlistSetItemColor doesnt works or only for me.. You might check it

thanks for your report, I will check it.

Link to comment
  • Scripting Moderators
8 hours ago, Hamatora said:

Well, dgsDxGridlistSetItemColor doesnt works or only for me.. You might check it

Now I think I fixed it. plz updatedgs and check it.

Link to comment
  • Scripting Moderators
1 hour ago, Skully said:

You should make a GitHub repo and allow other people to contribute, it'll help in finding a solution faster.

Good Idea, but I have never worked on it. xD

Link to comment
  • 2 weeks later...
  • Scripting Moderators
3 hours ago, Ridden said:

hi, it's need dgs script is running? because if all player joined the server and each one downloading 8mb or more  it's very high.???

8MB? In dgs, there is just a msyh.tff ( a font ) that is big. But once a player downloaded it, it won't be download it again if he doesn't clear mta cache. 

Link to comment

i try to do a function for to open/close the panel by bindkey,but it show this error

 call:failed to call 'dgs:dgsDXGUISetVisible'[string"?"]

script file:

DGS = exports.dgs
matable = {}
matable.window = DGS:dgsDxCreateWindow (0.10, 0.28, 0.78, 0.29, "VIP panel", true)
matable.button = DGS:dgsDxCreateButton(0.34, 0.77, 0.31, 0.18, "set", true, window)
matable.label = DGS:dgsCreateLabel(0.42, 0.31, 0.36, 0.43, "TrollSkin", true, window)

function outputEditBox ( player)
	if source == matable.button then
	print("works1")
        			setElementModel(getLocalPlayer (player ) ,10 )
			print("skin of"..getPlayerName(player).."has been changed to VIP Troll Skin", 10, 186, 31)
				else 
				print("don't work")
		
    end
end



function guiToggleVisible ( )        
        if ( DGS:dgsDxGUIGetVisible ( window ) == true ) then -- check if the dgs element is visible               
                DGS:dgsDxGUISetVisible ( window, false ) -- if it is, we hide it
							showCursor(false)
							print("works2")
        else              
                DGS:dgsDxGUISetVisible ( window, true ) -- if not, we make it visible
							showCursor(true)
				end		
        end
		
bindKey ( "F2", "down", guiToggleVisible )
--EventHandlers


    addEventHandler ( "onClientDgsDxMouseClick", matable.button, outputEditBox )

 

Edited by Ridden
Link to comment

@Ridden

DGS = exports.dgs
matable = {}
matable.window = DGS:dgsDxCreateWindow (0.10, 0.28, 0.78, 0.29, "VIP panel", true)
matable.button = DGS:dgsDxCreateButton(0.34, 0.77, 0.31, 0.18, "set", true, window)
matable.label = DGS:dgsCreateLabel(0.42, 0.31, 0.36, 0.43, "TrollSkin", true, window)

function outputEditBox ()
	if source == matable.button then
		setElementModel(getLocalPlayer(), 10)
		print("skin of"..getPlayerName(getLocalPlayer()).."has been changed to VIP Troll Skin", 10, 186, 31)
	else 
		print("don't work")
    end
end

function guiToggleVisible()        
	if (DGS:dgsDxGUIGetVisible(matable.window) == true) then               
		DGS:dgsDxGUISetVisible (matable.window, false) 
		showCursor(false)
		print("works2")
    else              
		DGS:dgsDxGUISetVisible(matable.window, true) 
		showCursor(true)
	end		
end
		
bindKey ("F2", "down", guiToggleVisible)
addEvent("onClientDgsDxMouseClick", true)
addEventHandler("onClientDgsDxMouseClick", matable.button, outputEditBox )

didn't really test but it should work

Edited by kikos500
  • Like 1
  • Thanks 1
Link to comment

Hi man,

very nice class but here are two things:

1. You wrote the wrong Script in the meta.xml (Line 84-86)

   <export function="dgsDxCreateRadioButton" type="client" />
    <export function="dgsDxRadioButtonGetSelected" type="client" />
    <export function="dgsDxRadioButtonGetSelected" type="client" />

You export the same Function two times, so dgsDxRadioButtonSetSelected don't work, if the user of the script don't edit it.

 

2. Can u update the GitHub Version ?

Link to comment
  • Scripting Moderators
On 2017/8/17 at 02:58, SmoothGarlic said:

Hi man,

very nice class but here are two things:

1. You wrote the wrong Script in the meta.xml (Line 84-86)

   <export function="dgsDxCreateRadioButton" type="client" />
    <export function="dgsDxRadioButtonGetSelected" type="client" />
    <export function="dgsDxRadioButtonGetSelected" type="client" />

You export the same Function two times, so dgsDxRadioButtonSetSelected don't work, if the user of the script don't edit it.

 

2. Can u update the GitHub Version ?

OK, Thanks To Report ! :D

Link to comment

@thisdp Is the combobox working? I'm getting this error everytime I try to make one.

dgs\functions.lua:239: attempt to index field '?' (a nil value)

This is the code I'm testing it with;

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        mainWindow = exports.dgs:dgsDxCreateWindow(0.65, 0.59, 0.22, 0.14, "ComboBox Window", true)
	        testCombo = exports.dgs:dgsDxCreateComboBox(0.09, 0.27, 0.52, 0.54, true, mainWindow)
        exports.dgs:dgsDxComboBoxAddItem(testCombo, "Test Item")
    end
)

I'm on update 2.75.

Edited by Skully
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...