Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. addBlip(52, -1940.97986, 568.07715, "Bank", tocolor(255,255,255,255)) * Where on your screen? * local blipX = math.max(MiniMap_x, math.min(MiniMap_x+MiniMap["width"], blipX)) local blipY = math.max(MiniMap_y, math.min(MiniMap_y+MiniMap["height"], blipY))
  2. IIYAMA

    [Help] Camera

    By editing the offset values of this function: https://wiki.multitheftauto.com/wiki/AttachElements
  3. IIYAMA

    [Help] Camera

    see this example with vehicle: https://wiki.multitheftauto.com/wiki/GetCamera
  4. Using a variable in this case might boost a very little performance. But not in a way that it will matter too much. A case where it will actually have a significant effect: local table = {value = 12000} -- onClientRender local value = table.value dxDrawText(value) dxDrawText(value) -- boost ! These steps will be reduced to 1x instead of 2x. (1. Using the table reference to find the table object. Not sure if this actually takes more time than a numeric value.) 2. Searching in the table. Which takes time.
  5. for i = 1, #playerTable.player.savedcols do local saved_col = playerTable.player.savedcols[i] if saved_col == playerTable.player.colshape then -- finding it playerTable.player.colshape = playerTable.player.savedcols[(i + 1) <= #playerTable.player.savedcols and (i + 1) or 1] -- set new col break end end I still not understand why you use the ~= operator. So I left that one out for now. This code will search for the actual col. Trigger: Matching Action: move to the next one. @majqq
  6. Do you mean moving the first colshape to last position in the table? And cycle that. Or do you mean going over the index from any given index: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, etc. Or start cycle the index at the point where they match? 1, 2, 3, 4 = matching, 5, 6, 7, 8 ,9 10 Starting the cycle at index 4. 5, 6, 7, 8, 9, 10, 1, 2, 3 (stop)
  7. Then it would be fine.
  8. IIYAMA

    Script Problem

    @iRack I do not recommend posting ripped stuff, the owner might get mad at you. Just saying. local l_11_1, l_11_2, l_11_3 = getElementPosition(l_11_0)
  9. @majqq hmm I just wondering how your code works. Shouldn't this make more sense? -- loop with problem local insertCol = true for i = 1, #playerTable.player.savedcols do local saved_col = playerTable.player.savedcols[i] if saved_col == colshape then outputChatBox("saved_col == colshape, break") insertCol = false break -- uhm, should break and not add colshape to table? end end if insertCol then table.insert(playerTable.player.savedcols, colshape) -- in case of any questions, i tried to add condition here but that doesn't help end
  10. Because the addEventHandler + "onClientRender" will use more memory than a timer. Unless you have already attached an addEventHandler . Then it is more or less two function call's every frame vs a timer.
  11. Not possible unless you are actually running gta san on your server. Which I am not sure if virtual machines go that far. You are still missing that gpu after all. An extra home pc maybe? Which you can control with the server.
  12. 1 active timer = setTimer 1 active timer + dx countdown = getTickCount 500+ active timers = (getTickCount or 1 global setTimer ) passive timers = getTickCount It depends on the quantity, precision and the functionality you want to use next to it. And yes with onClientRender you have to mind reducing the check amount. I can send you an example how I build my global lua timer, if you want.
  13. The else statement does not help?
  14. The keyword break does not stop the code block from executing. It only stops the next loops.
  15. IIYAMA

    exports

    @Zcraks giveXP is your export function NOT givePlayerXP. as salh said. exports["lvlsyt"]:giveXP(source, 200) -- or call ( getResourceFromName("lvlsyt"), "giveXP", source, 200)
  16. IIYAMA

    exports

    is it set as export function?
  17. IIYAMA

    exports

    @Zcraks You can't call an element like you would do with a function. function functionName () -- a function end functionName() -- calling the function So: exports [ "lvlsyt" ]:givePlayerXP (source (getRootElement()) , 10)
  18. Where are the blips located when the rendertarget is not being used? (screenshot ?) And what are the properties of the rendertarget?
  19. Your reply is just a status update, nothing more, nothing less... Do Work iterative Creating > Problem? > show code/results and ask for feedback > apply changes > TEST > Does it not work? > show NEW code/results and ask for feedback > apply changes > TEST > Does it not work? > show NEW code/results and ask for feedback > etc.
  20. There are no serious changes required for the table. But it might be handy to create an array structure first and then convert it to an object structure. This is the basic: The table local theTable = { ["First Aid Kit"] = {slots = 24, category = "Medicine"}, ["First Aid Kit2"] = {slots = 46, category = "Medicine"}, ["First Aid Kit3"] = {slots = 8, category = "Medicine"}, } Convert to an array structure: local collection = {} for key, data in pairs (theTable) do collection[#collection + 1] = {key = key, data = data} end Sort the damn thing: function sortFunction (a, b) return a.slots < b.slots end table.sort(collection, function (a, b) return sortFunction(a.data, b.data) end) For each: function forEach (key, data) print(key, data) end for i=1, #collection do local item = collection[i] forEach(item.key, item.data) end Which can enchanted with Lua OOP. (not MTA OOP) But as far as I know you do not work with it, never the less:
  21. Set the rendertarget recording BEFORE the loop. Your current code only records 1 blip, clears+sets the rendertarget, records 1 blip, clears+sets the rendertarget, etc. Also unset the rendertarget AFTER the loop. Which I can't see in your current code because it is cut off.
  22. Use newElement, that is a variable. not elementName which is just a "string". Or in this case an empty variable.
  23. @slapz0r You can use also: root -- attach to the mother element of all elements resourceRoot -- attached to the resource which it is currently executed in local newElement = createElement("elementName") -- attach to a new element of your choice
  24. With modules. https://wiki.multitheftauto.com/wiki/Modules If you know the program language C++, then you are good to go. Otherwise stay with the export functions.
  25. "Line 1\nLine 2" With \n There are also settings within the function itself, to cut down text automatic. https://wiki.multitheftauto.com/wiki/DxDrawText But does not work in combinatie with colour codes enabled:
×
×
  • Create New...