Tails

Members
  • Content count

    685
  • Joined

  • Last visited

  • Days Won

    2

Tails last won the day on January 17

Tails had the most liked content!

Community Reputation

88 Popular

4 Followers

About Tails

  • Rank
    Crime Partner
  1. Very nice Loki! Hopefully this will help out everyone who needs help setting this whole thing up. It's not an easy thing to do if you're completely new to all of this.
  2. Lod, objects and distance

    You need to make a separate LOD object for every object. https://wiki.multitheftauto.com/wiki/SetLowLODElement Here's an example: local obj = createObject(id, x, y, z, rx, ry, rz) local lodObj = createObject(id, x, y, z, rx, ry, rz, true) setLowLODElement(obj, lodObj) engineSetModelLODDistance(id, 300)
  3. Use https://wiki.multitheftauto.com/wiki/OnClientGUIChanged it will trigger whenever someone is typing in an editbox. If you want to constantly check if someone is typing then use the focus and blur events like MIKI suggested.
  4. passing a player in triggerServerEvent

    When a client triggers a server event a hidden variable called 'client' is passed in the event. triggerServerEvent("blabla", bla) -- server addEvent('blabla', true) addEventHandler('blabla', resourceRoot, function(bla) print(bla, getPlayerName(client)) end)
  5. [HELP] GridList

    @SSKE The scrollbar is part of the gridlist, it shows up when there are more items than can be shown.
  6. [HELP] GridList

    http://static.cegui.org.uk/static/WindowsLookProperties.html#ForceVertScrollbar guiSetProperty(gridlist, 'ForceVertScrollbar', 'False') I think that should do it.
  7. Outlined text

    You can use render targets perfectly fine. They aren't rendered to the screen they are rendered to a new texture at run time. The image is the only thing that's being drawn to the screen. So, you could have a 100 draw functions and render it to a single texture and only draw that texture to the screen with dxDrawImage. The reason your text became blurry with render targets is because you were either stretching the image or the positions/dimensions were off. Take this simple object oriented approach and you'll have an easy to use function. It works similar to the CEGUI functions except that you're responsible for drawing it, although you could make the function handle that as well. function dxCreateFramedText(text, left, top, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) local self = {} local rt = dxCreateRenderTarget(width, height, true) self.draw = function(x, y, w, h) dxDrawImage(left, top, width, height, rt) end self.update = function() dxSetRenderTarget(rt, true) dxDrawText(text, 1, 1, width + 1, height + 1, tocolor(0, 0, 0), scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(text, 1, -1, width + 1, height - 1, tocolor(0, 0, 0), scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(text, -1, 1, width - 1, height + 1, tocolor(0, 0, 0), scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(text, 1, 1, width - 1, height - 1, tocolor(0, 0, 0), scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(text, 0, 0, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) dxSetRenderTarget() end self.setText = function(v) text = v self.update() end self.setColor = function(v) color = v self.update() end self.update() return self end local msg1 = dxCreateFramedText("Hello there",222,300,520,140,tocolor(0,255,0),3,'default','left','top',false,false,false) local msg2 = dxCreateFramedText("How are you?",222,400,520,140,tocolor(0,255,0),3,'default','left','top',false,false,false) addEventHandler('onClientRender', root, function() msg1.draw() msg2.draw() end) msg2.setColor(tocolor(0,255,255)) addCommandHandler('c', function() msg1.setColor(tocolor(255,99,0)) end) It may look a little over the top but yeah, it works, and it's fast.
  8. Outlined text

    You can pre-render everything with a render target and then draw it with a single dxDrawImage An example: local text = dxCreateRenderTarget(width, height, true) dxSetRenderTarget(text, true) dxDrawText ( message , left + 1 , top + 1 , width + 1 , height + 1 , tocolor ( 0 , 0 , 0 , 255 ) , scale , font , alignX , alignY , clip , wordBreak , postGUI ) dxDrawText ( message , left + 1 , top - 1 , width + 1 , height - 1 , tocolor ( 0 , 0 , 0 , 255 ) , scale , font , alignX , alignY , clip , wordBreak , postGUI ) dxDrawText ( message , left - 1 , top + 1 , width - 1 , height + 1 , tocolor ( 0 , 0 , 0 , 255 ) , scale , font , alignX , alignY , clip , wordBreak , postGUI ) dxDrawText ( message , left - 1 , top - 1 , width - 1 , height - 1 , tocolor ( 0 , 0 , 0 , 255 ) , scale , font , alignX , alignY , clip , wordBreak , postGUI ) dxDrawText ( message , left , top, width, height, color , scale , font , alignX , alignY , clip , wordBreak , postGUI ) dxSetRenderTarget() addEventHandler('onClientRender', root, function() dxDrawImage(left, top, width, height, text) end) It should be pretty easy to understand. If you need help putting it in an easy to use function let me know.
  9. Transparent Editbox

    You can set the alpha property with setProperty: local edit = GuiEdit(200, 200, 200, 30, '', false) edit:setProperty('Alpha', 0.5)
  10. Question about guiCreateEdit

    Use this https://wiki.multitheftauto.com/wiki/GuiEditSetCaretIndex with onClientKey
  11. Ground Position (server)

    You can make a function on the client side and trigger it using a custom event. Then you trigger another event on the server that receives the ground position. An example: -- client side addEvent('getGroundPos', true) addEventHandler('getGroundPos', resourceRoot, function(x, y, z) triggerServerEvent('onGetGroundPos', resourceRoot, getGroundPosition(x, y, z)) end) -- server side addEvent('onGetGroundPos', true) addEventHandler('onGetGroundPos', resourceRoot, function(groundPos) print(groundPos) -- continue your function here end) The only bad thing about this is that you always need a player nearby to get the ground position but there's no other way around it as far as I know. You may also need an additional check to make sure the server event is only triggered once, if you have multiple players on your server then it gets triggered by every player.
  12. [HELP] How to do action with every array element

    @Randesady I know you fixed it already but your example works if you remove the return false statement and the return true in the else block. When you return something within a loop you'll also break the loop so that's why it never goes past the 1st iteration.
  13. [DGS]Advice on this Open Source Dx Lib

    Better optimization. I've tested your script, did the button performance test. 30 fps. Now, realistically you wouldn't really have 1k buttons but I did check overall performance, and it's just not that great imo. I found that it takes up quite a bit of resources and especially on older computers with lower end gpu's it has negative performance impact. Seems that your code is doing lots of calculations each frame when it doesn't have to. You can overcome some of this by using render targets and eliminate any unnecessary calculations by only updating it when a change occurs, like a mouse enter/leave, click, etc. Render targets are great for this, however, real optimizations would still need to be done. Secondly, why didn't you make it object-oriented? That would certainly make your code a lot shorter, more structured and a lot more manageable than it is right now. Especially with inheritance you could probably cut down your code up to 1/3 of what it is now. I can give you a hand in that if you like. Anyway, keep up the work, you certainly have one of the most complete frameworks out there which I applaud you for that.
  14. Prevent vehicle despawn.

    Probably what you need https://wiki.multitheftauto.com/wiki/ToggleVehicleRespawn
  15. vehicle limit

    Do you have multiple colshapes? Instead of root use co4 as the root. addEventHandler("onColShapeHit", co4, checkVehicles) also, you may want to make sure it's a vehicle that's hitting the colshape: if (getElementType(theElement) == "vehicle") then