Jump to content

Dzsozi (h03)

Members
  • Content Count

    645
  • Joined

  • Last visited

  • Days Won

    1

Dzsozi (h03) last won the day on December 25 2017

Dzsozi (h03) had the most liked content!

Community Reputation

72 Popular

About Dzsozi (h03)

  • Rank
    Crime Partner

Details

  • Location
    Hungary

Recent Profile Visitors

4,662 profile views
  1. Sorry for not responding, I was busy with work, I didn't try your method yet. I might need further help, I can't figure out right now in my head if it would work and I can't try it now. I will let you know if I managed to do something, thank you for your help!
  2. Hello community! I would like to do custom sky gradients that are changing color properly based on time. I got everything working I wanted except the main thing, which is the calculation of the fading. First I tried using interpolateBetween, but I came across a topic on stack overflow (link) from which I learned that I can use the RGB colors and some calculation for interpolation. But of course this also needs some kind of progress definition. I had several attempts on calculating the progress based on the current time so I would have a kind of automatic system, but every of them failed a
  3. Exports do not work across clientside and serverside. I meant to write "... to get the variables from another resource". The question is how can I return something like vehicle.fuel in a different resource when hitting a marker for example. But I guess I will just stick to element data then with a custom data system, at the moment I really don't know any other solutions, triggering back and forth sounds a lot of inefficient and unnecessary work. But how can I call a method from a different resource like I mentioned above? In vehicleScripter resource how do I call the vehicleCre
  4. Alright, I am getting closer to what I need, but I think I am not doing something correctly, also I am still stuck at the "variable-data-transferring" between client and server. I rewrote the script based on your comments and Daniel Lett's videos, now it looks a little bit different. -- i got this function from Daniel's video function Class(tbl) -- set a metatable on the passed tbl parameter -- __call property -- create a new table -- on that new table, set __index to our class -- call a constructor method on the class -- return our new table setmetatable(tbl, { __call = f
  5. I've watched every single MTA scripting tutorial from Daniel Lett, big shout outs to him btw, I learned some new things from their videos even though I am into scripting for a while now. My DB system is kinda similar to his from the videos because I want to remake my stuff in OOP, so basically kinda starting from stratch, I have an idea of the things I would like to do, I just don't know how to do some of them now that I experience with this OOP method. And I think it is more efficient in some ways, mainly just because you write less text in codes, means less data to convert into zeros an
  6. So then I don't understand how should I implement custom functions in my scripts, for example setFuel([element] vehicle, [int] value) and such things. I thought I must specify them inside the first table where I create and specify every default variable. Or you mean exactly like that, to create the above mentioned function then use a custom function outside of the vehicleCreator class where I use the fuel consumption method to update the fuel variable of the vehicle? Sorry, it isn't clear for me yet. Because after that in a different gas station script, how do I use the self.fuel variable
  7. I have one more question, can I get a custom variable like self.fuel of a vehicle [element]? So let’s say I want to display the fuel on client, so I just have to write something like this local vehicle = localPlayer:getOccupiedVehicle() dxDrawText(vehicle.fuel ... —bla blaa If it is, how can I achieve it? I really appreciate and accept every suggestions you think I might need to know about OOP and optimized easy to read code!
  8. Hello community! A few days ago I jumped into learning OOP scripting and started creating a new vehicle system with it. I stumbled into a few problems when I finally created a basic vehicle creator script. I added fuel first of all, but when I wanted to create a gas station script for it (this would be in a different Lua file because of readability and organization), I couldn't think of how to get the fuel variable of the vehicle. This problem got me thinking if I made the current system correctly at all? Regarding to this problem I got one more question. I don't know how I shou
  9. So no matter what, I will have to use at least 2 tables for the item positions? Btw sorry for the lots of questions, I’ve never created or worked with inventory systems by myself. Also, what should be the value of the ignoreID variable in this case?
  10. I came to the conclusion that I can basically use one table for the item list which holds the currently opened inventory’s items and the indexes of this table represent the items’ position, like this itemTable = { {name = "item1", size = {1, 1}}, -- 1 {name = "item2", size = {1, 3}}, -- 2 } ------------------ -- this should be the temporary item table which I don't save, because it is for drawing the items of an opened inventory(?) inventoryItems = { -- [x position/column] = {[y position/row] = {itemData}}, [2] = { [3] = {itemID = 1, value = 100}, }, } So in my m
  11. So based on this logic I assume that I should make utility functions like isSlotFree(x, y) and then check the indexes inside the table, then if an index is same as the given variable it should return false, am I correct? Then use this function to check movent of an item by player to a hovered slot. But when beginning the calculation and adding a new item, how do I set it’s first position if there are already items in the inventory, but lets say there is just enough space at the bottom of the inventory? What should be the criteria or logic behind checking for free positions anywhere i
  12. Hello MTA community! I would like to make an inventory system, which has different sized items (1*1, 2*1, 1*3, etc.), so the inventory space would matter based only on your space management. Here are some example photos of what I mean: I haven’t started coding yet, that is the reason I created this topic. First of all I am trying to put together a structure and I would like to hear your opinions and suggestions on how to make this type of inventory. I have some main questions but please let me know anything you think I might have to know regarding this topic.
  13. These videos in this topic show a much more different system from what is currently done. Soon when I fix most of the known bugs and be ready with unfinished systems, I will be uploading a new video about it.
  14. https://community.mtasa.com/index.php?p=resources&s=details&id=15679 With this resource you are able to get/modify the position of a vehicle's cargo space. The position you get is the middle of for example a Bobcat's bed, so if you want to add lots of objects you will have to use some loops for positioning. Look at the exampleS.Lua in the resource. local function testFunction2() local vehicleObject if not isElement(vehicleObject) then local cargoPos = exports["vehiclecargo"]:getVehicleCargoPlacementPosition(source) if cargoPos then local x, y, z = getPositionFrom
  15. Thank you! I had to change some things up a little bit to match my needs and get it done correctly, it's working now just as I wanted to!
×
×
  • Create New...