Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. IIYAMA

    firefighter

    You may not be able to check it 100%, but you can always create an overwrite to solve the problem.
  2. For you as beginner, I would recommend you to create a gui button and make it invisible on top of your rectangles. https://wiki.multitheftauto.com/wiki/GuiCreateButton https://wiki.multitheftauto.com/wiki/GuiSetVisible When you are getting better at lua, you can start learning new and cleaner techniques.
  3. replace it with: isPedDead https://wiki.multitheftauto.com/wiki/IsPedDead or write in console: upgrade RPGcivilians
  4. IIYAMA

    help!

    Aha, my mistake, never noticed it before. O_o
  5. IIYAMA

    help!

    Items are strings, not tables.
  6. Add admin rights?
  7. This is circa how I am solving this problem every time I am creating a resource. client addEventHandler("onClientResourceStart",resourceRoot, function () triggerServerEvent("registerPlayer",localPlayer) end) server local playerLoadedRegistery = {} addEvent("registerPlayer",true) addEventHandler("registerPlayer",root, function () if isElement(source) then playerLoadedRegistery[source]= true end end) addEventHandler("onPlayerQuit",root, function () playerLoadedRegistery[source]=nil end) function triggerClientEvent2(...) -- event,sourceElement,arg1,arg2,arg3, etc. local argTable = ... for player,boolean in pairs(playerLoadedRegistery) do triggerClientEvent(player,unpack(argTable)) end end
  8. Afaik there is a death reason, number 53. https://wiki.multitheftauto.com/wiki/Death_Reasons
  9. 1 Those markers aren't working since you are using an ipairs loop which only works at the array. (should be a pairs loop) 2 Nothing checks which player enters the marker, thePlayer should be compared with localPlayer before opening the gui.
  10. IIYAMA

    Side Camera

    Afaik you can also re-attach your camera to your ped. Take a look at the example at this page: https://wiki.multitheftauto.com/wiki/GetCamera
  11. Function works fine with me, you should execute it clientside.
  12. https://wiki.multitheftauto.com/wiki/GetElementMatrix Take a look at the examples. Wiki source:
  13. setAccountData (account, "funmodev2-carupg", toJSON (getVehicleUpgrades(car))) local upgrades = getAccountData (account, "funmodev2-carupg") if upgrades then for i,v in ipairs (fromJSON(upgrades)) do addVehicleUpgrade (vehicle, v) end end Use LUA tags, pls.
  14. Or replace them using a shader, but you will be limited by it.
  15. IIYAMA

    Ped

    setElementFrozen(LVHshop,true)
  16. Custom fonts have terrible anti-aliasing and subPixelPositioning argument probably doesn't work well on them. I am not a fan of custom fonts.
  17. There must be changes, fonts are vectors formats that have their own raster. By enable subPixelPositioning the font will be using it's own raster and it will flow. Like switching in Photoshop from sharp to smooth. The first time I enabled it, I saw directly the differences. Those are default fonts right? If they are, then I will recommend you to make a screenshot with another computer, because anti-aliasing is enabled for default fonts.
  18. @Xabache Clientside and serverside are two total different systems. They both have their own jobs, in most cases they are different pc's. In some cases you can do things one sided, but design, rights and possibility's are spilt up by those sides. Are you aware of their purposes and why there are functions that can only can be executed on one side?
  19. You tried to use a render target? When using rendertargets you will lose your anti aliasing/sub-pixels. What I will recommend is to enable the subPixelPositioning argument during drawing your text. [b]subPixelPositioning:[/b] A bool representing whether the text can be positioned sub-pixel-ly. Looks nicer for moving/scaling animations.
  20. for i=1,#cars do local carTable = cars[i] if carTable[1] == carID then outputChatBox("Price: " .. carTable[2]) break end end There are more possibility's to do this, but that depends about how you use this tables in other ways. When you change the table you are able to use other ways.
  21. Well that depends on your intentions. The function dxGetTextWidth will might be handy to make something fit inside a rectangle. But the relative size DxGetFontHeight might do it, but because it is a custom font I am not sure if the result will be correct. The best thing you can do is draw the text and make a screenshot of it. Use photoshop to check how much pixels high it is and in the end you can calculate the relative size. So yes the font height is the solution, but I will recommend you to try both ways.
  22. IIYAMA

    [HELP] Table

    ah your OOP functions are elementdata instead of accountdata. I am not using OOP functions, so I wasn't sure which it was. I am using no OOP functions because I know a lot of mta functions out of my head. function onSave(player) if isElement(player) then local serial = player:getSerial() or "" -- just in case local name = player:getName() or "" -- just in case local health = player:getHealth() or 100 -- just in case local x, y, z = getElementPosition(player) local pos = toJSON({x, y, z}) local needs, status, items = {}, {}, {} for k, v in pairs(Table) do for i, data in pairs(v) do if (k == 'need') then needs[#needs+1] = player:getData(data[1]) -- [#needs+1] < making sure it starts from the first index. elseif (k == 'stat') then status[#status+1] = player:getData(data[1]) elseif (k == 'item') then items[#items+1] = player:getData(data[1]) end end end player:setData('logged', false) needs, status, items = toJSON(needs), toJSON(status), toJSON(items) getDB():exec('UPDATE `accounts` SET `login` = ?, `health` = ?, `pos` = ?, `needs` = ?, `status` = ?, `items` = ?, `lastdate` = NOW() WHERE `serial` = ? LIMIT 1', name, health, pos, needs, status, items, serial) outputServerLog('Account Name: '..name..' was saved automatically.') end end Anyway take a closer look at my notes. Also on what are the accounts based? Name or serial? Because you can never rely on the player his name.
  23. IIYAMA

    [HELP] Table

    Looping through a table which uses custom indexes(something else then numbers) isn't very efficient, but sometimes you have to. I am more worried about the functions(especially database functions) than the loops you are using. When I take a look at your examples, I assume example 2 is more efficient then example 1. Because when you start a loop, the code inside it will be temporary saved in to the ram, which will speed up when the loop executed more then one time.
  24. Everybody has time for his hobby ones in while.
  25. IIYAMA

    [HELP] Table

    Just make sure you don't access the database too much, or your server might crash. Of course you can loop through all the players and store the data when you shut down the server. It will peak your cpu usage, but it must not be constantly like that.
×
×
  • Create New...