Jump to content

Bonsai

Members
  • Posts

    1,031
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Bonsai

  1. So go and make them? This is not a place where you post what you "want" and other people do it for you..
  2. Try it yourself first, then come back..
  3. Bonsai

    Fixed

    Original posts should be auto quoted. And that guy should be banned.
  4. How is that different? Isn't there just one "end" too much?
  5. /debugscript 3 first please.
  6. I have it too and it is kinda annoying but after all its not so bad. Somewhen it was gone for me, until I reinstalled Windows. Then it came back. So apparently there is something somewhere that can disable this, but I don't know where.
  7. I once made something like that for a Rankingboard, maybe its what you need. It works fine for me, but you should probably not use it inside a render function. function RankingBoard.dxClipTextToWidth(text, width) while dxGetTextWidth(text, RankingBoard.fontSize, RankingBoard.font, true) > width do text = text:sub(1, #text-1) end return text end
  8. Hey, I have a problem with CEF. I'm using it to create some simple windows on the screen, such as Userpanel. But some people have heavy lags when opening such a window while having pretty good hardware. For other people, even with worse hardware, its totally smooth. I asked some of them about their resolutions and they all use different ones. Does anyone know why this happens for some people? Is there some known problem, some MTA setting, that can cause this problem? Bonsai
  9. I can't believe this topic is still active. This is MOST obviously never gonna happen.
  10. Having to nil it manually isn't that bad after all. I changed it like that now and it works perfectly so far. Now i will change all my other classes to do it the same way. Having only one render function and a loop inside instead of mulitple handlers seems to be a better solution now indeed. Thanks, Bonsai
  11. Yep, thats what I wanted to avoid But seems there is no other way then. Thanks for your detailed answers. Btw, if I create an instance somewhere like this: local object = MyClass.new(init); And I have a destroy method that does something like self = nil inside the class. Will "object" be nil too or do I have to destroy it in a different way? Bonsai
  12. You didn't mention what problem you have exactly, Errors etc.
  13. Thank you, now it doesn't show that error for "addEventHandler" anymore. But I can't use "self" in the render function like this. Every object has different things to draw, and I need to access them using self. Do you know how to solve that? Bonsai
  14. Hey Peeps, can I somehow use a method as the function argument for event handlers? I tried something like this but it doesn't work: This is an OOP example from Google: local MyClass = {} MyClass.__index = MyClass setmetatable(MyClass, { __call = function (cls, ...) return cls.new(...) end, }) function MyClass.new(init) local self = setmetatable({}, MyClass) self.value = init return self end -- the : syntax here causes a "self" arg to be implicitly added before any other args function MyClass:set_value(newval) self.value = newval end function MyClass:get_value() return self.value end local instance = MyClass(5) -- do stuff with instance... So imagine one of these methods would handle drawing stuff on the screen. Then I would need to add an event handler that calls it. function MyClass.new(init) local self = setmetatable({}, MyClass) self.value = init addEventHandler("onClientRender", root, self:draw, true, "low-99") return self end At least thats what I thought. But it outputs this error in log: "..function arguments expected near.." Does anyone know how I can make it work? I need each object to have its own handler. Bonsai
  15. I wish The connection is only used for some db functions in other resources. But by now I think the error message was just wrong. There is no way it can become a marker by script. Bonsai
  16. dbConnect is only used once by that resource. Other resources just use the connection. But I discovered another problem with this now. After some hours, the queries started to fail and the Error was "Expected db-connection, got marker". I have no idea how that could happen... Bonsai
  17. function Database.main() Database.connection = dbConnect("mysql", "dbname=**;host=**" ,"**", "**") if not Database.connection then Database.connection = dbConnect("mysql", "dbname=**;host=**" ,"**", "**") if not Database.connection then outputDebugString("Database Connection failed!") end else outputDebugString("Database Connection successful!") end end addEventHandler("onResourceStart", resourceRoot, Database.main) function Database.kill() if isElement(Database.connection) then destroyElement(Database.connection) end outputDebugString("Database Connection killed!") end addEventHandler("onResourceStop", resourceRoot, Database.kill) function getConnection() return Database.connection end Thats all. The last function is exported to be used by other resources.
  18. Bonsai

    Server list spam

    Hey, Original: mtasa://144.76.68.79:22653 Fake: mtasa://144.76.68.79:22183 http://puu.sh/p5FjV/1a01368435.png Bonsai
  19. Hey Peeps, I'm having a little problem with my Mysql Database connection. If the server just started, it works fine. But if I restart my database resource, it won't connect anymore. I'm also using destroyElement on the connection in the onResourceStop event of that resource. Does anyone know what the problem is? Bonsai
  20. Yes that true, but the resources are being created and deleted at some point, with a clientside script being added. So it will always have to download the script again, since its a different resource.
  21. Hey Peeps, I need to create/start/stop/delete small resources dynamically but I don't want the players to be annoyed by the transfer box every time. So what about an argument for the startResource function that allows you to start it silently? Or is there any reason why this has not been done already? Bonsai
  22. Its rather a function than an event. But you can probably already do that with existing functions. If velocity in -Z direction is not enough, then you could use IsLineOfSightClear to check if the player/vehicle has anything below it. Therefore chances are too low that such a function would make it into the game I guess.
  23. One of the most retarded things I have ever read on this forum. Hopefully just trolling.
  24. Bonsai

    [solved]

    Thank you, matchingdimension worked perfectly. And yeah, it was hard to explain Remind me to next time quote your post before helping
  25. Bonsai

    [solved]

    I didn't completely understand the problem, but maybe this helps: https://wiki.multitheftauto.com/wiki/OnMarkerHit There is not just a player parameter, but also one to check if its in the same dimenstion.
×
×
  • Create New...