Jump to content

IIYAMA

Moderators
  • Posts

    6,058
  • Joined

  • Last visited

  • Days Won

    208

Everything posted by IIYAMA

  1. You didn't update the code, so I can't say anything. That tutorial is using different sourceElement, baseElement and sendTo elements. Nothing like your code.
  2. triggerClientEvent("dxDrawMessageText", getRootElement(), message) triggerClientEvent("dxDrawMessageText", getRootElement(), "") addEventHandler("dxDrawMessageText", getLocalPlayer(), function(message) triggerClientEvent("dxDrawMessageText", resourceRoot, message) triggerClientEvent("dxDrawMessageText", resourceRoot, "") addEventHandler("dxDrawMessageText", resourceRoot, function(message) If you do not understand how the event system works, then you can better replace the baseElement of the triggerclient/serverEvent + addEventHandler with resourceRoot until you have studied that. Documentation: https://wiki.multitheftauto.com/wiki/AddEvent https://wiki.multitheftauto.com/wiki/Event_system https://wiki.multitheftauto.com/wiki/AddEventHandler https://wiki.multitheftauto.com/wiki/Element_tree https://wiki.multitheftauto.com/wiki/Event_Source_Element
  3. Probably with: https://wiki.multitheftauto.com/wiki/DxCreateScreenSource And capturing and drawing the screen on the correct processing order. https://wiki.multitheftauto.com/wiki/Game_Processing_Order
  4. It has nothing to do with maths. But with breaking down the instructions (for the computer) in to pieces and debug every piece individually. When running this code you gave the computer 4 instructions. 1. Load the file Runs a debug line if added. 2. Attach the eventhandler (returns true if attached, which is a value you can debug) 3. The event is fired, which calls the function you have attached. If you did add a debug line here, you would have noticed that the code didn't run. (If the debug line is not visible, then there must have been something with the addEventHandler) Hmmmmaybe compare the code to something similar that does work? 4. Call your custom function. Check which value it returns. This is something that takes time to learn. So maybe put some more time in debug your code in details. This will save you a lot of time in the long run.
  5. See string.sub from my previous reply. It is used to select a range of characters. So if you know the length with string.len , then you can select a shorter range of characters.
  6. Locked (no support for this kind of things, please read the forum rules)
  7. I am not a string reg prof, but it works... ? local theString = "254646" local length = string.len(theString) local visibleCount = math.max(length - 2, 0) print(string.rep("*", string.len(string.sub(theString, 1, visibleCount))) .. string.sub(theString, visibleCount, length))
  8. See https://wiki.multitheftauto.com/wiki/Split http://Lua-users.org/wiki/StringLibraryTutorial string.len string.rep local emailParts = split("[email protected]", "@") iprint(emailParts[1]) iprint(emailParts[2]) iprint(emailParts[1] .. "@" .. emailParts[2]) iprint(string.rep("*", string.len(emailParts[1])) .. "@" .. emailParts[2])
  9. IIYAMA

    find in db

    You can't index a non existing table. So you have to check if it exist before indexing a second time. if result[1] then
  10. IIYAMA

    find in db

    I am not sure what uid is. But normally you would have 1 column called: id Which auto increment when items are added. This value makes sure that each item added is unique. In some cases for example a login system you can also set the username as primary key, which is to prevents duplication for the usernames. So make sure that you understand your own data. LIMIT is used to select only a maximum items. If you need 1 item, you put the limit to 1, so that the database knows that it has to stop when it found what it is looking for. - Selecting a max amount of items. - Increase the performance.
  11. IIYAMA

    find in db

    Use the SELECT query. It is not as if you should combine queries. The error is given because it is protecting itself from item duplication. Which means that it already went wrong. SELECT uid FROM accs WHERE uid = ? LIMIT 1
  12. @gubi What's with that visibleTo stuff? visibleTo is not the same as a parentNode, which can't be a table because it is not a node, neither a player which is not allowed to have children from resources. And even if it was allowed, it wouldn't change the visibility for players. This is where it matters: https://wiki.multitheftauto.com/wiki/Element_tree
  13. Not possible, unless you freeze the system by using a temporary infinity loop. Or use a custom resource as replacement.
  14. Line 7: use resourceRoot instead of root. Else the code will be executed for every starting resource. Minimal timer delay should be 50. (Atleast that was a problem I had in the past) Don't create timers within loops. Don't create timers within timers. (Dangerous)
  15. Every player in the server does have an account. If the account is not created by script, then it is a guest account, which is automatic deleted when it is not required any more. if not isGuestAccount ( acc ) then
  16. Ah oke Just don't add words that make it really aggressive: I meant, i've created my function for idle animations, not ready-to-use animations. And how can I reset players' idle time. So? WUTEVA, I DON'T NEED HELP WITH THIS ANYMORE! It will back fire and you get less help instead of more.
  17. Please behave yourself. We do not want to inherit your stress.
  18. See this function + example: https://wiki.multitheftauto.com/wiki/GetPlayerIdleTime
  19. @#~Scared In the editor there is a map setting called useLODs. (Also you can just edit the meta.xml of the map) <meta> <info type="map" version="1.0.0"></info> <map src="test-lods.map" dimension="0"></map> <settings> <setting name="#maxplayers" value="[ 128 ]"></setting> <setting name="#useLODs" value="[ true ]"></setting> <setting name="#gamespeed" value="[ 1 ]"></setting> <setting name="#minplayers" value="[ 0 ]"></setting> <setting name="#gravity" value="[ 0.0080000004 ]"></setting> <setting name="#waveheight" value="[ 0 ]"></setting> <setting name="#camera" value='[ [ [ &quot;0&quot;, &quot;0&quot;, &quot;0&quot; ], [ &quot;0&quot;, &quot;0&quot;, &quot;0&quot; ] ] ]'></setting> <setting name="#locked_time" value="[ true ]"></setting> <setting name="#weather" value="[ 0 ]"></setting> <setting name="#time" value="12:0"></setting> </settings> <script src="mapEditorScriptingExtension_s.Lua" type="server"></script> <script src="mapEditorScriptingExtension_c.Lua" type="client" validate="false"></script> </meta> This will enable a list of GTA san lowLOD elements. (but it doesn't include all, there for you have to script a little bit more to use default elements as lowLOD objects, edit the mapEditorScriptingExtension files for that. Keep performance in mind while making those tweaks.)
  20. Not create and attach the eventHandler to a new function. Use global named functions that can be attached and detached when it is no longer required. You currently created something you might consider similar to a memory leak.
  21. Hmm, now they work. Maybe related to an update of some sort, because I couldn't see them the moment I replied.
  22. That is already added. If that is not happening, then you will have to follow my instructions in my previous reply. Which should contain a copy of the new code with debug lines + results.
  23. I do recommend for your tests to only use Lua function. When using for example chat functions, MTA could/has have implemented a text buffer, if the queue is full it could either speed up or slow down the function speed (depending how it is programmed).
  24. @KaMi I can't see any images. ?
  25. Just for the people that didn't notice it. but ipairs as well as pairs are functions. Before you actually running the loop, you are executing (pre-process) functions. players = {1,2,3,4} theFunction, players2 = ipairs(players) -- note: players and players2 are the same table (not a copy) print(theFunction(players2, 0)) -- 1, 1 print(theFunction(players2, 1)) -- 2, 2 print(theFunction(players2, 2)) -- 3, 3 print(theFunction(players2, 3)) -- 4, 4
×
×
  • Create New...