Tails

Members
  • Content Count

    702
  • Joined

  • Days Won

    2

Tails last won the day on January 17 2018

Tails had the most liked content!

Community Reputation

98 Popular

5 Followers

About Tails

  • Rank
    Homeboy

Recent Profile Visitors

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

  1. Hotfix has been uploaded! New bugs may be introduced with this version, however, playing videos should work again for the most part. Consider this is a temporary fix until we find a new and better solution. I also replaced the switch browser button with a Skip Ads button. This is basically a refresh button which will help you skip ads. Download the latest version here: https://community.multitheftauto.com/index.php?p=resources&s=details&id=12950
  2. We're currently looking at solutions right now. We may just have to use the default youtube page now and crop the image a bit. There are some issues though with popups and ads covering the video, but we could put the screen browser in the panel so you can interact with it and remove any popups shown or skip ads. Stay tuned.
  3. Instead of sending a PM, please clarify it here in this thread, so others can help too such as myself.
  4. Make sure you put lang.lua before client.lua in the meta file so it loads first.
  5. You can use table.sort for sorting, but first you have to extract the data you want from the table and place it in another to make it iterable. For instance: local sorted = {} for itemId, itemData in pairs(myItems) do table.insert(sorted, itemId) -- extract item ids end -- sort the items table.sort(sorted, function(a, b) return a < b end) iprint(sorted) You can also sort it by the item count local sorted = {} for itemId, itemData in pairs(myItems) do table.insert(sorted, itemData) -- extract the item data instead end table.sort(sorted, function(a, b) return a.count < b.count end) As you can see you can extract any data from your tables and sort them however you like.
  6. Don't use metatables just for simple table lookups, that's only asking for problems and will decrease performance. In your case (response to original post) an int loop would be faster: for i=1, #playerTable.playerItems do local v = playerTable.playerItems[i] outputChatBox("item: "..v[1]..", count: "..v[2]) -- item: Item, count: 1 end However I can imagine that with a list of 1000's of items you wouldn't really want to loop this table over and over. What you're doing is, you're inserting a new table for every item and there isn't really any way to get the "Item" from the table with a single lookup other than looping the entire thing. What you could do is change the structure of the table to something like this: -- a fixed table that contains all the item ids and information local items = { ['apple'] = {desc = 'A green apple', name = 'apple'} -- an item with id 'apple' } local myItems = { ['apple'] = {count = 10}, -- player has an item with id 'apple' and has 10 of them } Now you'd still have to loop it if you wanted to get all the items at once but if you want to get the count of a specific item you can access it according to the item id. -- say you know the item id, all you do is local item = myItems['apple'] if item then print(item.count) end -- for instance function takeItem(id, count) local item = myItems[id] if item then if item.count >= count then item.count = item.count - count end end end -- if you want to get all then you loop it for id, item in pairs(myItems) do print('ID:', id, 'Count:', item.count, 'Description:', items[id].desc) end Notice you don't have to loop it in the takeItem function which will help with performance. So instead of table.insert you keep a key table where the id's are fixed and don't change so that you can access them by their key/id. Hope this helps.
  7. Tails

    Expected account

    @1LoL1 cause getAccountPlayer expects an 'account' element but getAccount returns false cause it didn't find the account. All you need to do is add a check, for example: if account then -- continue here end Next time you use a function check the wiki page for it, it explains exactly what it will return and what it returns in case there's a mistake. In your case it didn't find the account so it returned false. Hope this helps.
  8. Or listen for the resourceBlocked event and request each blocked domain to be unblocked. addEventHandler('onClientBrowserResourceBlocked', browser, function(url) requestBrowserDomains({url}, true, function(accepted) if accepted then reloadBrowserPage(browser) end end) end)
  9. @Sorata_Kanda you can't pass any sort of functions or metatables unfortunately. However as IIYAMA said you can use loadstring to inject code into your scripts. I wrote this a while back: function load() return [[ function import(name) if type(name) ~= 'string' then error("bad arg #1 to 'import' (string expected)", 3) end local content = exports.import:getFileContents(name) if not content then error("can't import '"..name.."' (doesn't exist)", 2) end return loadstring('return function() '..content..' end')()() end ]] end function getFileContents(name) if not name then return end local path = 'exports/'..name..'.lua' if fileExists(path) then local f = fileOpen(path) local content = f:read(f.size) f:close() return content end return false end If you put this in a resource called "import" then you'd use it like this: loadstring(import.exports:load())() local utils = import('utils') iprint(utils) This loads files directly into a variable in your script. Ofcourse you can easily modify this to load files from different resources. Also in said files you will have to return the class or function or whatever you need to return just like real modules.
  10. not supported, however you can do this... local link = "https://media.rockstargames.com/rockstargames-newsite/img/global/downloads/buddyiconsconavatars/sanandreas_truth_256x256.jpg" local pix requestBrowserDomains({link}, true, function(accepted) if not accepted then return end fetchRemote(link, function(data, err) if err > 0 then error('Error: ', err) end pix = dxCreateTexture(data) end) end) function teste() if pix then dxDrawImage(0, 0, 256, 256, pix, 0, 0, 0, tocolor(255, 255, 255, 255), false) end end addEventHandler("onClientRender", root, teste) I didn't test it but it should work
  11. I found both movement and camera speed to be really slow, especially the camera. It takes 3-4 seconds for me to rotate the camera 360 degrees, unless I crank up the dpi on my mouse, which I rarely do. There should be an option to change the camera speed. Here's what the UI looks like: https://imgur.com/a/hcKVmV0
  12. @CodyJ(L) I tested the editor out yesterday and I know it's just alpha but I had a hard time understanding the UI and the controls. First thing I noticed when I opened up the editor was the UI. The UI is really small on 1080p and the menu's are also way too small. Second, it took me a while to figure out how to toggle the mouse and camera mode, almost up to the point where it irritated me. I expected it to be in camera mode right off the bat. Neither mouse or camera mode were toggled. When I was finally in camera mode, I could barely move my camera around because it's set to really slow by default. Also the camera overall behaved a bit strange imo. Finally, I decided I would place some objects, so I looked for the object list. Again, the UI is small and the lists are really tiny so it's hard to navigate in. I tried selecting and double clicking the items in the list but nothing would happen. At this point I had no idea what to do.I tried for a few more minutes but I just couldn't figure out how to place objects. When the beta gets released I will give it another try. Hopefully things will be better then. Good luck!
  13. Looking really good so far. Is there going to be custom binds?
  14. Are you supplying the video file through the resource meta? if so, you don't have to worry about it. the resource will only start once the download has finished. Otherwise if the browser is not a local browser then there's no way to know if something has finished downloading.