Jump to content

Tails

Members
  • Posts

    731
  • Joined

  • Days Won

    10

Everything posted by Tails

  1. @SSKE The scrollbar is part of the gridlist, it shows up when there are more items than can be shown.
  2. http://static.cegui.org.uk/static/WindowsLookProperties.html#ForceVertScrollbar guiSetProperty(gridlist, 'ForceVertScrollbar', 'False') I think that should do it.
  3. 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.
  4. 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.
  5. You can set the alpha property with setProperty: local edit = GuiEdit(200, 200, 200, 30, '', false) edit:setProperty('Alpha', 0.5)
  6. Use this https://wiki.multitheftauto.com/wiki/GuiEditSetCaretIndex with onClientKey
  7. 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.
  8. @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.
  9. 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.
  10. Probably what you need https://wiki.multitheftauto.com/wiki/ToggleVehicleRespawn
  11. Tails

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

    vehicle limit

    I don't see anything that teleports all vehicles to one point, however, you are looping through all vehicles, which is weird considering you're only trying to move one vehicle. Get rid of the loop.
  13. Make it so the indicators stick to the edges of the screen when you face away from them. If you didn't add that already. I couldn't tell in the video.
  14. Set isLocal to false when you're loading the localhost This worked fine with my server local browser = guiCreateBrowser (0, 10, 500, 500, false, false, false) local theBrowser = guiGetBrowser (browser) function setURL() loadBrowserURL (source, "http://localhost:3000") end addEventHandler ("onClientBrowserCreated", theBrowser, setURL)
  15. Just change the address in loadBrowserURL
  16. Edited my post didn't read the comments in the code
  17. Try youtube.com or mtasa.com which should work without requesting the domains Else try adding port 80 after localhost like "localhost:80/index.html"
  18. You're setting the URL too fast. Use the browser events. You'll need to use this one: https://wiki.multitheftauto.com/wiki/OnClientBrowserCreated
  19. A quick and easy way would be to add this if (getZoneName(player.position, true) == "Las Venturas") then return end --> function spawn( player ) if getZoneName(player.position, true) == "Las Venturas" then return end local rnd = math.random( 1, #spawns ) setElementPosition( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3] ) end addCommandHandler("pvp",spawn)
  20. Tails

    Safe zone

    Try adding this if attacker ~= localPlayer then
  21. What part are you stuck with? Please provide some actual code so we can help you with it.
  22. I've never heard of anti-bounce. What is it?
  23. if not z == 20 then Is what you're doing but z will probably never be 20 exactly, so do z >= 20 instead. return then you're returning but that doesn't stop the object use stopObject() and then return it. Hope this helps.
×
×
  • Create New...