Jump to content

Th3Angel

Members
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Th3Angel

  • Rank
    Square
  1. That's the same thing I thought. But, I thought that triggering events take up more memory, as I read it on triggerEvent of the wiki. The base element is the root element. root is a predefined variable across all serverside and clientside scripts that returns the root element of the server. The full list is here: viewtopic.php?f=91&t=39678.
  2. Actually, I was talking along the lines of something like this: local images = {} images[1] = guiCreateStaticImage(x, y, width, height, text, relative, parent) images[2] = guiCreateStaticImage(x, y, width, height, text, relative, parent) images[3] = guiCreateStaticImage(x, y, width, height, text, relative, parent) -- ... images[30] = guiCreateStaticImage(x, y, width, height, text, relative, parent) function onClientGUIClickHandler(button, state, absoluteX, absoluteY) for k, v in pairs(images) do if (source == v) then -- Code end end en
  3. Which one would be better in terms of efficiency, a loop in one event handler or many event handlers. For example, if I were to create many gui-images and store them in an table, would using a loop be more efficient, or would creating an individual event handler for each gui-image be more efficient.
  4. Ok. Thanks Kenix and Solidsnake14 for sparing your time and helping me!
  5. Aah, ok. So the same applies for variables too?
  6. 1. I'm not quite sure if this will actually work as I don't know what elements getElementColShape works with, but you can try using getElementColShape and then use isElementWithinColShape. If that doesn't work, an alternate way could be to create colshapes on every pickup created and track the player's current pickup that they're standing on by using onClientColShapeHit and onClientColShapeLeave. 2. I don't believe there is anything like that. A simple way to replicate it would be to use dxDrawText and getScreenFromWorldPosition along with getDistanceBetweenPoints3D for range detection and s
  7. I'm not referring to lexical scopings, I'm asking how scripts share information between each other such as functions and variables. But thanks for informing me of clientside-serverside and serverside-clientside communication! Let's use 50p's GUI Classes for example. No functions are exported, you only have to include the lua file in meta.xml to use the functions of the different gui classes. So if one function exists in a clientside script, can I use that same function inside another clientside script? Do the same rules apply for serverside scripts? Will this also work with variables?
  8. Evening everyone, I have a few quick questions for anyone that wants to help me. How exactly do functions and variables "communicate" with each other between the server and client. For example, if I have a function in a clientside script, will I be able to access that same function on the server? Does the same thing apply for serverside script? What if I try to access that function from the clientside script in another clientside script and vice versa, will that be possible? What about variables in the same scenario? I'm asking this because I've noticed that Lua has "local" functions and I'v
  9. Ahhhh, thanks for your reply! I greatly appreciate it. Edit: Also, one quick question. How exactly are strings treated? For example, are '' (no text) and ' ' (one or more amount of spaces) treated the same? If not, what would be the best way to detect this? I was thinking about checking the return value of string.find(string, "%a+") for nil, but wasn't sure if it was the most efficient way to do it.
  10. Oh, ok! Thanks for your help! Also, I'm a little puzzled as in how things get executed outside of events and functions. I know that things get executed by the order you script it. If I declare a global variable 'root' outside of all functions and just at the top of a script and set it to the return value of getRootElement, then how will the execution of getRootElement go? Does it just get executed once? Or is it executed multiple times? I'm guessing that it is executed once.
  11. Ah, so what I thought was correct. So for clientside scripts, I wouldn't need to store any values in a table for every player, right? Like, whenever someone enters a vehicle, I set the variable 'isInVehicle' to 1 for that player. If there were two players, one in a vehicle and one on foot, then the variable for the player that is in a vehicle would be 1 and for the player that is on foot it would be 0?
  12. Good evening everyone. I'm fairly new to scripting and I've been reading the tutorials on the wiki and official lua documentation. What I'm mainly confused about is clientside scripts and how they run. Serverside scripts don't get downloaded to the client while clientside scripts do. Clientside scripts are neccessary for functions such as GUI creation and things only possible on the client's side. So do the clientside scripts run per every user? And when that user quits does the clientside script stop getting executed? Or does it run as a whole like the serverside scripts do and only run once
  13. I download it and then I open it and there are no servers.
×
×
  • Create New...