Jump to content

NeXTreme

Members
  • Posts

    117
  • Joined

  • Last visited

Everything posted by NeXTreme

  1. Hello, The wiki page for addEventHandler provides a good description of this parameter: "The handler will only be called when the event it is attached to is triggered for this element, or one of its children.". To understand this, you need to be familiar with the Element Tree. Basically, the attachedTo parameter allows you to restrict the events to a particular element. If I have, for example, 3 GUI buttons, If I were to attach an onClientGUIClick to the Root Element, it would be triggered when any of the 3 buttons are clicked. However, if I attach the same event to just one of those 3 buttons specifically, it will only get triggered when that specific button is clicked. To know what element to attach an event handler to, look at the Source section on the event's wiki page. For events like onClientClick, it says: "The source of this event is the client's root element." . The root element is on the top of the element hiearchy, therefore your only option here is to attach it to the root element. As mentioned before, with an event like onClientGUIClick, you can attach it to the root element to receive GUI click events from ANY resource, you can attach it to getResourceRootElement() to receive GUI click events from only THIS resource, or you can attach it to a specific GUI element and only get events from that single element. Of course, you can always attach an event to any element you like. With custom events (say, showLoginGui like yours) it's important to consider how the event will propagate. If you have the same event registered in two different resources and have both attached to the Root Element, you couldn't really control which one you want to trigger. The Event System page provides a good description of how this works exactly, I highly recommend you read it.
  2. Download link seems to be broken, could you post a new one?
  3. Me and my friend are having a problem where the local player can't be killed (with explosions, weapons) by other players, when the camera's position is set to a distant location, making the player and his vehicle out of the streamer's range. For example, if I'm position in my car near Vinewood, and then move my camera (but not myself) to Las Venturas, I can't be killed by weapons, explosions, neither can anybody push me around. Any solutions to this?
  4. local result = mysql_query(handler, "INSERT INTO accounts (accname, accpassword) VALUES ('"..username.."', '"..password.."')")
  5. TBH, I have no clue on this then. Can you post a screenshot of how it looks tho? I'm interested.
  6. Are you using guiCreateStaticImage or DX functions? I had some issues in the past with guiCreateStaticImage, where images had like "stripes" on them.
  7. You should get highest quality by using an image with dimensions that are a power of 2 (for example, 128 x 128) and drawing that image in 1:1 scale in MTA. As soon as you start to scale the image in MTA, it's quality will reduce. If you ARE scaling, make sure the image position and sizes are Integers (whole numbers), and that they are an even number. Should help a bit.
  8. Hello. I'm having a bit of a problem using engineApplyShaderToWorldTexture. Maybe I am just missing something? Anyway, I am using this function to replace a texture. What is really annoying here is that the "old" SHADED texture (yes, seems to already be shaded by GTA itself) doesn't get stored anywhere - just the render states get stored. I can recreate the original effect by just adding a pass with no custom vertex and pixel shaders. However, this is now a huge problem for me, because I then can't do correct lighting calculations on my custom texture drawn with the second pass. Also, there is now severe flickering on the place where two textures are. Solutions?
  9. https://community.multitheftauto.com/index.php?p= ... ls&id=5059 https://community.multitheftauto.com/index.php?p= ... ls&id=5058 Attempt to spread a Trojan/RAT/Keylogger Fail-d!
  10. Requesting removal of this resource https://community.multitheftauto.com/index.php?p= ... ls&id=5002 Stolen from my clan (TG)
  11. Hey. I've noticed that functions like fileCreate, fileWrite and fileClose work on client-side. However, when I try to do fileOpen or fileExists on a file that's in ANOTHER RESOURCE, It fails. I can confirm the file is really there on my computer. Is there a built-in limitation to MTA that prevents reading files from other resources or am I just doing something wrong? If so, the information on wiki should be corrected immediately. outputChatBox(tostring(fileExists(":testres/banana.lua"))) --> false Edit: I've tried placing this line ouside the function where I need it, precisely in a "onClientResourceStart" event handler, and over there it works perfectly. As soon as I place this in any function that gets run at a latter time, it fails.
  12. Oh I see... Well in that case, add an event handler for onColShapeHit right after you create it local shape = createColRectangle(x, y, sizex, sizey) addEventHandler("onColShapeHit", shape, functionToCall)
  13. proColshape = createColSphere(0,0,0, 5) -- your colshape (coords 0,0,0, radius 5) addEventHandler( "onColShapeHit", proColshape, function( ) local result = mysql:query("SELECT gangs, teren, color1, color2, color3, alpha, x, y, sizex, sizey FROM turfs") if (result) then local continue = true while continue do row = mysql:fetch_assoc(result) if not (row) then break end local gangs = tonumber(row["gangs"]) local teren = tostring(row["teren"]) local color1 = tonumber(row["color1"]) local color2 = tonumber(row["color2"]) local color3 = tonumber(row["color3"]) local alpha = tonumber(row["alpha"]) local x = tonumber(row["x"]) local y = tonumber(row["y"]) local sizex = tonumber(row["sizex"]) local sizey = tonumber(row["sizey"]) local shape = createColRectangle(x, y, sizex, sizey) local turf = createRadarArea(x,y,sizex,sizey,color1,color2,color3,alpha) end mysql:free_result(result) end end ) I guess this would do the trick?
  14. I never said I'm using their API
  15. getResourceFiles sounds like it gets files that are included in the meta.xml only (which can also be accomplished via some XML scripting). The function should list all files in the directory of the resource it's runnning from. However, it must not list files from other resources, since that can be a security issue (like, reading autologin information from other servers).
  16. NeXTreme

    Streaming memory

    I find it weird that the "Streaming memory" option only allows me to set it to 256mb max. My video card is supposed to be 1GB. I don't know how GFX cards work, but plain logic tells me that the maximum available memory should be 1GB then. Is this an issue or just the way things work?
  17. A feature like a translator can easily be done via scripting. I made a translator myself that uses Google's translation service. I don't think this feature is necessary to be implemented in MTA.
  18. The way I did it for TG: When you fire a projectile, mark it with setElementData (store the player that fired it) Then, there are collision spheres around every player. If the missile enters the collision shape of the player, the player is marked with that missile's ID. Now, if the player dies a few moments later, you can simply use getElementData on the missile to find the player that fired the rocket. If the player didn't die within, say, 500 milliseconds, clear the rocket's ID from the player. Not a very reliable way to do it, but it works decently.
  19. I can't use PHP to scan client-side directories.
  20. It would be really helpful if we had a function to retreive a list of all files in a resource's directory. We already have a bunch of functions for handling files. I was surprised there's no function that would list all the files, really. An example use would be files = {} files = fileList() -- list all files in the current resource's running directory files = fileList("/client") -- list all files in the current resource's subdirectory "client" (ex. joinquit/client/)
  21. I wanted to pass the element itself to the server.. Anyway, seems I'm better off just creating the element itself on server-side...
  22. Hey. I've been trying to create an object on client-side, then pass it with an event to server side and do stuff with it from there. Calling the event fails, and I've done some testing trying to debug it. Seems that if the element only exists in client-side, you can't pass it over to the server. So, is there a way to create an element on client-side, and then "moving" it to server somehow and making it a "legit" element there too? Obviously trying to avoid calling a server-sided function to create the object, and then returning it back to the client again.
×
×
  • Create New...