Jump to content

ds1-e

Scripting Moderators
  • Posts

    636
  • Joined

  • Days Won

    8

Everything posted by ds1-e

  1. Then you maybe might go to other place and check it there?
  2. First of all, getRootElement() should be changed to resourceRoot, otherwise this function will trigger, if any resource starts. Second. You need to know certain indexes, quote from wiki: https://wiki.multitheftauto.com/wiki/SetDevelopmentMode I don't think there's need to use pairs or ipairs loop, just int loop. If you will get them, answer here, i'll try to help you with it.
  3. Not sure, but take a look here: https://wiki.multitheftauto.com/wiki/World_sound_groups You can use loop to disable them, if you don't know how, let me know.
  4. Yes, probably works, i'm very grateful, your tutorial and help solved my biggest nightmare, thanks mate.
  5. You mean width and height? I will try. EDIT: I should do it for everything?
  6. Honestly, i don't understand why this is happening. My res: 1280x960, second res: 1280x1024, i don't know why button pos is incorrect. On other resolutions same. 1. 2. Code: local centerX = screenX/2 local centerY = screenY/2 -- function scaleSize(size, devY) if not size or not devY then outputChatBox("scaleSize: Missing arguments.") return end if size and devY then local scaleValue = screenY/devY scaleValue = math.max(scaleValue, 0.85) local scaledSize = scaleValue * size return scaledSize end end -- function getScreenStartPositionFromBox(width, height, offsetX, offsetY, startIndicationX, startIndicationY) local startX = offsetX local startY = offsetY if startIndicationX == "right" then startX = screenX - (width + offsetX) elseif startIndicationX == "center" then startX = screenX / 2 - width / 2 + offsetX end if startIndicationY == "bottom" then startY = screenY - (height + offsetY) elseif startIndicationY == "center" then startY = screenY / 2 - height / 2 + offsetY end return startX, startY end -- local position_gui = {inventory_window = {}, loot_gridlist = {}, loot_button = {}} position_gui.inventory_window[1], position_gui.inventory_window[2] = getScreenStartPositionFromBox(750, 480, 0, 0, "center", "center") position_gui.loot_gridlist[1], position_gui.loot_gridlist[2] = getScreenStartPositionFromBox(350, 385, 15, 60, "left", "top") position_gui.loot_button[1], position_gui.loot_button[2] = getScreenStartPositionFromBox(30, 320, 364, 60, "left", "top") -- local inventory_window = guiCreateWindow(position_gui.inventory_window[1], position_gui.inventory_window[2], scaleSize(750, 960), scaleSize(480, 960), "", false) local inventory_gridlist = guiCreateGridList(position_gui.loot_gridlist[1], position_gui.loot_gridlist[2], scaleSize(350, 960), scaleSize(385, 960), false, inventory_window) local inventory_button = guiCreateButton(position_gui.loot_button[1], position_gui.loot_button[2], scaleSize(30, 960), scaleSize(320, 960), "->", false, inventory_window)
  7. Helpful and nice person, thank you for all advices :P

  8. Thanks for scaling part. Seems like it worked. I would like to see positioning tut also. I'm confused because, I've readed lots of tutorial, but still i can't get it to work. This thing is correct? -- left screen side --x = coords -- from left to half of screen -- half of screen --x = screenX/2 -- to center elements -- right screen side --x = screenX - coords -- from right side
  9. Hey. I have a few questions about triggers. 1. Wiki says: Everything what my gamemode needs, it's in same resource, so there's no need to use root as theElement? 2. Quote from wiki: There's need to check if trigger was sent? And if so how, to check that? Declare it to variable? 3. And here's question about securing data when using triggers - https://wiki.multitheftauto.com/wiki/Script_security This is how it should looks? -- clientside triggerServerEvent("updateTable", resourceRoot, getLocalPlayer()) -- server-side local client = client -- nothing wrong in declaring client as local? following performance tips :D function updateTable(player) if client then -- if incoming data is from client if source ~= resourceRoot then -- source it's theElement argument called from client? return false end if player ~= client then -- if source it's resourceRoot then i need to pass player as argument? for additional compare it with client variable? return false end end -- end of security check end addEvent("updateTable", true) addEventHandler("updateTable", resourceRoot, updateTable) Also, please take a look at comments in code, if you can, explain me everything 4. Nothing wrong if i would name event same as the event handler function? Kinda weird, maybe stupid question, but i want to be sure
  10. if elementBackpack[source] and isElement(elementBackpack[source]) then -- ... end
  11. ds1-e

    Trigger/tables

    Hey, IIYAMA, i've tested both, onClientPlayerWeaponFire, and onPlayerWeaponFire, i would like to use them for sync. The problem is that server-side variation of this event doesn't trigger for RPG. I thought about solving this by adding condition which checks if weapon == RPG and then send trigger to server, and sync. I am not sure if this would be best solution, that's why i'm asking you about it.
  12. Looks like this update fixed it, thank you :-]
  13. ds1-e

    marker bug

    Send updated code.
  14. ds1-e

    marker bug

    if isElementVisibleTo(theElement, visibleTo) then -- do something end theElement: The element you want to check the visibility of visibleTo: The player you want to check against
  15. I can't start MTA without killing MTA San Andreas.exe process. 1. Starting MTA, i can wait long time, nothing happens. 2. Task manager -> MTA San Andreas.exe -> Kill process. 3. Finally, MTA runs. Also it informs, that i need to kill GTA SA.exe process because it's already running.
  16. If something, problem still exist. About running MTA. Client ver: v1.5.6-release-18674
  17. You might check this topic, if you are about to select XML or JSON.
  18. CPU usage seems to be fine, however my MTA can't run without killing MTA San Andreas.exe process.
  19. https://pastebin.mtasa.com/600060374 My result: https://prnt.sc/o34qlf Friend result: https://cdn.discordapp.com/attachments/300428941817151488/590318522111098890/unknown.png
  20. From my friend - https://pastebin.mtasa.com/237806699
×
×
  • Create New...