vicisdev

Members
  • Content Count

    25
  • Joined

  • Last visited

Community Reputation

9 Neutral

About vicisdev

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Why? Yeah, as soon as I can fix some issues and write a doc.
  2. Fala galerinha. A maioria dos servidores tendem a "bindar" teclas de forma totalmente inconveniente como por exemplo colocando inventário no I, mouse no M, já cheguei a ver inventário no K, etc. Isso pode levar à uma má experiência por parte dos usuários já que dessa forma seria-los necessário tirar a mão de um controle principal do jogo - mouse, WASD - para executar funcionalidades secundárias. Além de que, bindar muitas teclas diferentes pode causar confusão e dificulta a memorização delas. Então, para tentar resolver esse tipo de situação, comumente vista em servidores estilo RPG, esse resource torna fácil a criação de teclas com multi-funcionalidades baseada em contextos. Sua principal aplicação é juntamente com os colshapes. Com eles é possível anexar diferentes colshapes à diferentes elementos e fazer uma única tecla executar funcionalidades em ambos eles. Alguns exemplos básicos são interações com NPCs, interagir com vending machines, reparar uma parte específica de um veículo chegando perto e apertando a mesma tecla e muito mais. Depende só da criatividade. Eu vou lança-lo assim que eu documentá-lo e corrigir alguns problemas de performance, mas vocês podem dar uma olhada na minha página do Github. Infelizmente eu gravei o vídeo só em inglês, mas basicamente eu mostro como é fácil alterar a funcionalidade de uma tecla apenas mudando os contextos em que ela se aplica.
  3. Multi Key Context System Most of server owners tend to bind keys in an unconvenient way like show inventory bound to letter I or K. This can lead to a bad user experience while playing in your server as it would be needed to leave a main control to activate a secondary - leave mouse or WASD to press F1, F2, Fn. Also, binding too much different keys can cause confusion and it's hard to remember. To overcome this lack of keys, which happens mainly in RPG style, this resource makes multi functionalities bound to a key easy to use following a context based approach. The main useful thing of it is with colshapes. You can attach colshapes to different elements and make a single key interact with both in different ways. Some examples are interaction with NPCs, sprunk vending machine, repair single car parts by getting close and pressing a key and much more. It's all about creativity. I'll release it as soon as I can fix some performance issues and make a documentation, but you can see it on my Github.
  4. Yeah, this is the approach I'm following now. Where can I share it when it's finished, like a showcase and stuff?
  5. Yeah, but the main thing is adding new entries programatically which leads to server/client only insertions. It would be magic if I could force a shared environment when calling a function so the api knows "ok this has to be added here and there" just like what happens when you manually, directly, make calls or insert data on a shared file. There is a way to extract a loaded function's implementation so you get its string? If so ... maaan, revolutionary!
  6. Ooh, great solution, actually. I've read loadstring doesn't return values, I was wrong. I'll need to change some implementations, but this is fine, thank you!
  7. I'm making a key binding api for my server, but I'll need to change the approach I guess I would really like to know what @IIYAMA has to say about this
  8. Yeah guys ... it sadly doesn't work -- shared_script.Lua addEventHandler("onPlayerJoin", root, function() local server_table = { function() return true end, function() outputChatBox("ANOTHER FUNCTION") return false end, "sadsad" } for k, v in pairs(server_table) do triggerClientEvent("r", source, k, v) end end) addEvent("r", true) addEventHandler("r", root, function(i, v) outputChatBox("RECEIVED > " .. inspect(i) .. " > " .. inspect(v)) end) https://i.imgur.com/E5TV6dS.png (i cant insert images ,_, )
  9. Idk really ... I've tried to store the table full of functions in the root element with setElementData and all entries gone nil, so maybe functions are not synceable ... idk :p
  10. I'll try it. But I have almost sure the entries are going to be nil ... let me see and I'll give feedback
  11. I have a shared script that stores a parameter provided function into a table: -- shared_script.Lua local my_table = {} function addFunctionality(key, handler) my_table[key] = handler end The point is that it's stored two different tables - client and server side. When addFunctionality is called from a client script the handler is stored only inside the respective side table. What I need is a way to communicate between both client and server to store the handler in both tables independently of who is calling addFunctionality. The tables need to be synced and have the same data. I know there are functions server/client only, but forget that for now. For the purpose of this help bear in mind I'm trying to store this function: function() return true end But from the point of view of addFunctionality you never know how handler's implementation looks like. I've already tried to: - Use events, but they do not accept functions as arguments - Store the table in the root element, but it's not possible at all - Use loadstring, but 1) I don't know how handler's implementation looks like and 2) it doesn't return values Thanks
  12. Solved! The point is that os.time() returns an integer in seconds, so even if I multiply it by a thousand we miss a lot of information on cents, decimals, units in a range from 0 to 999. Just replace os.time() by getTickCount() and you're good to go, since this returns an integer in milliseconds.
  13. Oh, thanks! I really appreciate this kind of help. No, because I'm trying to make something more robust, versatile.
  14. I don't know if it's enough, but basically this is what's called every frame -- self.behavior is a table that describes the animation properties local elapsedTime = os.time() * 1000 - initialTime local time = elapsedTime / self.behavior.duration local progress = bezierInterpolation(time, self.behavior["cubic-bezier"]).x local element = self.element local x, y, z = unpack(initialPosition) local toX, toY, toZ = unpack(self.behavior.to) local newX, newY, newZ = x + ((toX - x) * progress), y + ((toY - y) * progress), z + ((toZ - z) * progress) setElementPosition(element, newX, newY, newZ) if time == 1 then removeEventHandler("onClientPreRender", root, renderHandler) end This function is called every frame, but because the values is too close from each other the API tries to save processing and updates only per second, I guess. 24 FPS 100 FPS
  15. Is there a way to prevent this from happening? I'm making a movement script with cubic-bezier support, but when I render the movement onClientPreRender the server kinda limit the executions. DEMONSTRATION