-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
I don't need that, I need a fix for the function: string.split.
-
Estas intentando updatear la cuenta, no el data que aparecera en el scoreboard.
-
I've built my own function to split the string by width, but it fails at second line for some reason: Source: function string.split ( text, maxWidth ) local oldlen = 1 local len = 1 local width = 0 local strings = { } for i = 1, text:len ( ) do width = ( width + dxGetTextWidth ( string.char ( text:byte ( i ) ), 1, "default-bold" ) ) if ( width > maxWidth ) then table.insert ( strings, text:sub ( oldlen, len ) ) oldlen = len width = 0 end len = i end if ( #strings == 0 ) then return text else return strings end end Screenshot of the problem: As you can see, there are some letters outside the rectangle.
-
@Soren: No, el quiere que al usar el comando, aumente el dato: "resets" en el scoreboard. @Plate: Estas mandando cualquiera, no tiene el menor sentido eso. Tenes que usar getElementData y setElementData.
-
Sorry, but I already done something similar. At start of function: local numLines = math.floor ( ( dxGetTextWidth ( text, 1, "default-bold" ) / 370 ) + 1 ) if ( #messages >= 6 ) then local extraLines = ( 6 - #messages + numLines ) for line = 1, extraLines do table.remove ( messages, line ) end end At end of function: for index, msg in ipairs ( messages ) do local index = ( index - 1 ) msg [ "y" ] = ( originalY + 18 * index ) end
-
Lo unico que estas haciendo ahi es reiniciar los datos, no estas aumentando los "resets".
-
I already have a way to get the total lines the string will use, I just need a way to make it work without bug. Edit: Kenix, the function: string.transfer only works with character len, but that doesn't work for this I noticed, I would need a function that divides text by width.
-
Volve a leer mi post anterior y corregi los errores mencionados.
-
Las funcions son exportadas de mi recurso, asi que tenes que usar: exports [ "exp_system" ]:function ( ) Porque usas "thePlayer" si tu argumento es "player"? estas pensando en lo que haces vos? P.D: es setPlayerEXP, con mayuscula "EXP".
-
Claro, pero vas a tener que crear tu propio sistema de resets, igual es muy facil usando las funciones de mi recurso.
-
What? that doesn't help.
-
function guiCreateColorLabel( ax, ay, bx, by,str, bool, parent ) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find( pat, 1 ) local last = 1 local r,g,b while s do if cap == "" and col then r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth( cap ) avc321 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) if not r then r = 255 end if not g then g = 255 end if not b then b = 255 end guiLabelSetColor( avc321,r,g,b ) ax = ax + w r,g,b = tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then local cap = str:sub( last ) local w = dxGetTextWidth( cap ) local avc123 = guiCreateLabel( ax, ay, ax + w, by,cap,bool,parent ) guiLabelSetColor( avc123,r or 255,g or 255,b or 255 ) return avc123 end end If that doesn't work, then search for "guiCreateColorLabel". P.S: I didn't make that function.
-
Labels don't support HEX codes, you can't do it. Although, around the forums there was a function to make it color coded.
-
I'm not one of these who ask for the script done, if you tell me how you think I can fix it. Edit: I've edited the function you've posted Kenix, and made it to use a table instead: function string.transfer ( s, nMax ) if ( type ( s ) == 'string' ) and ( type ( nMax ) == 'number' ) then local stringsTable = { } local nMaxOld = nMax local nLength = #s -- change to utfLen( s ) if you working with unicode. if ( nLength >= nMax ) then local nStart = 0 for nCount = 1, math.ceil ( nLength / nMax ) do table.insert ( stringsTable, s:sub ( nStart + 1, nMax ) ) nStart = nMax nMax = ( nMax + nMaxOld ) end return stringsTable end return s end return false end local stringT = string.transfer ( text, 45 ) if ( type ( stringT ) ~= "table" ) then local y = ( originalY + 18 * #messages ) table.insert ( messages, { [ "text" ] = text, [ "y" ] = y, [ "r" ] = r, [ "g" ] = g, [ "b" ] = b, [ "addTime" ] = getTickCount ( ), [ "table" ] = formatTable } ) else for index, msg in ipairs ( stringT ) do local y = ( originalY + 18 * #messages ) table.insert ( messages, { [ "text" ] = msg, [ "y" ] = y, [ "r" ] = r, [ "g" ] = g, [ "b" ] = b, [ "addTime" ] = getTickCount ( ), [ "table" ] = formatTable } ) end end That kinda fixed the problem, but now I got this new issue: As you can see, there is one extra text, it should only support 6.
-
I don't understand what do you mean.
-
function setText1 ( ) local time1 = getRealTime ( ) local monthday = time.monthday local month = ( time.month + 1 ) local year = ( time.year + 1900 ) guiSetText ( uhrzeitText2, "".. monthday ..".".. month ..".".. year .."" ) end P.S: Today is 27, not 25.
-
What it's supposed to do that script? is it yours?
-
You don't understand how it works, the problem is the HEIGHT of the word wrapped texts.
-
@myonlake: You mean split the whole string and send it as many messages? if so, then I already had that idea and didn't work either. @CapY: Why would I use timers? @Kenix: I didn't post the whole code because it was not required, that part of script is the part which fails.
-
You're talking about the F11 map?
-
Eso es porque te olvidaste de cargar el GUI ya creado, tenes que clickear en "Load GUI" y clickear el elemento principal.