Jump to content

pa3ck

Members
  • Posts

    1,141
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by pa3ck

  1. I was reading your post and I was like what did I just read ... why did you say that?
  2. Oh, I see, but in my opinion as long as you can actually see the caret in the right place, it's fine. Not having the text highlighted is not that big of a deal, I think having a memo without it would still be much better than only having single line editbox.
  3. Are you talking about the caret? (the ' I ' when editing)
  4. Honestly, I haven't looked through your code to see where the error could be, because I think you should try to clean it up first. You might not know this, but when you change the element data and it is synced (4th argument is sync true/false), it will trigger an event on the client side as well --> You don't need to use triggerClientEvent as well when using setElementData, because essentially you are doing the same thing twice. Try to code the following (saves performance and easier to maintain). -> User buckles their seat belt, get the current element data of the vehicle, something like "numSeatbelts" which will be the number of players with their seat belts turned on -> Since you changed the element data, you can use the event "onClientElementDataChange" and make sure the element data was changed for that vehicle and for the "numSeatbelts", now get the number of passengers in the vehicle and if it equals to the number of seat belts, turn off the sound, if it's less do the playSound, also make sure they are all sitting in the "source" element (vehicle). This will also play the sound for everyone in the vehicle or if you want, you can even attach the sound element and others will hear it in '3D'. Make sure you are using a table client-side to be able to identify which sound to turn off. EDIT: If you need to set the element data individually for players because you will use it in other scripts (eg. less health loss on collision), you can also save the player ID's on the vehicle's elementData, separated by a character, so you can split it and see who has their set belt on (assuming you already have an ID system) setElementData(veh, "seatBelts", "3,5,7") -> players with ID 3,5,7 have their set belts on, you can use split(string, ',') to get a table = {3,5,7}
  5. Ah, sorry man, there should be a feature that shows "Somebody else is writing a post.." or something, didn't realize you were about to send a reply.
  6. They are functions / code snippets developed by individuals like you, me or any other developer that think their code would help others. For example there's a function called IsMouseInPosition which is not implemented in MTA, you have to code it yourself, but somebody else already did and put it up there. If I was to use it, all I had to do is copy the whole function, paste it in your script and use it as you would use any other functions like: -- My code addEventHandler("onClientResourceStart", resourceRoot, function() if isMouseInPosition ( some X, some Y, some Width, some Height) then -- code end end) -- Useful functions function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end
  7. You can also just use: guiSetInputMode("no_binds_when_editing") guiSetInputEnabled(true) -- to disable the inputmode guiSetInputEnabled(false)
  8. If you're looking for a work-around or a trick, that let's you communicate between client/server without triggers.. unfortunately you just won't find such thing. You only have couple of options in MTA When the client logs in, send them all the data that will be used frequently, eg.: positions of interiors and whenever you create something new on the run, trigger to client the new data Use triggerServer / triggerClient event whenever you need something from the server Use setElementData and store all the data that will be used frequently on specific elements. eg.: Vehicles: id, owner, fuel; Players: id, character name, admin level (these are just examples) and whenever you need something that isn't often used eg.: getting some info about a player that will not be rendered in HUD etc Use something like you did there, but with an export to client as well, so you can access those data on the client side I understand you are trying to build your server as efficient performance wise as possible, I have been there... but you are limited and at the end of the day, it's a server, you are supposed to run it on a decent machine when expecting lots of players and it's supposed to be able to get stuff done. In my opinion, I would rather fill up the server's RAM, even if it used 3-4-5GB, rather than overloading the client, most of the players still have outdated PC's.. I think you should try out the performance tester resource and try to overload the server with a bunch of calls, just to see yourself how much it can handle.
  9. Can you change the password for that account and try to log in, did you try to remove the account and create it again?
  10. pa3ck

    Minimap

    We can't really help, because there are 1000 and 1 ways of creating the mini-map... Think of the functions/design elements you want and look at https://community.multitheftauto.com/ for any resources that looks / works like it, that will be your starting point.
  11. That is because the exact message is "Timed out" (lowercase 'o') and the string is case-sensitive. Reasons = { ["Unknown"] = "Nem tudni", ["Quit"] = "kilépett.", ["Kicked"] = "kirúgva a szerverről.", ["Banned"] = "kibanolva a szerverről.", ["Timed out"] = "kifagyott.", ["Bad Connection"] = "rossz internetkapcsolat" } addEventHandler('onPlayerQuit', root, function(reason) local name = getPlayerName(source) triggerClientEvent(root, "createNotification", root, "#FFffFF"..Reasons[reason], "simple", name) end )
  12. Are you sure you want to do that? Every time a collision happens you do a query and exec on the db? It's a very bad idea, you should think of a different way. Not sure what your gamemode is, but maybe only update the db when the driver leaves the vehicle?
  13. Ah, I see what you were saying now, so when you call the function multiple times you expected the variable to be 100 again (set to default). I wonder if that's intended though, who knows.
  14. Well I just don't know what to answer, is it a question / suggestion or maybe both?
  15. pa3ck

    can't store data

    That's not how it works.. you want to keep it local but you expect other functions to be able to access it? You can keep it local, but pass the variable to the other function(s) so they have access to it, try this and let us know what happens: function mg_pos() createMG(-2861.9, 19.4, 15.83, 0, 0, 188) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), mg_pos) function createMG(posX,posY,posZ,rotX,rotY,rotZ) local mg = createObject ( 356, 0,0,0) -- this is where the data will be stored (new line) local weapon_base = createObject ( 1897, posX,posY,posZ,rotX,rotY,rotZ) local weapon = createObject ( 356, 0,0,0) attachElements ( weapon, weapon_base, -0.55, 0, 0.75, 0, 0, 0) setElementData ( mg, "weapon_base", weapon_base) setElementData ( mg, "weapon", weapon) setElementAlpha(weapon_base, 0) setTimer ( event, 500, 1, mg ) end function event(mg) local weapon = getElementData ( mg, "weapon" ) triggerClientEvent("createRealWeapon", root, weapon, weapon2) end
  16. Adding a new column to the default scoreboard is really easy actually, you can take a look at this page: https://wiki.multitheftauto.com/wiki/Resource:Dxscoreboard Example: call ( getResourceFromName( "scoreboard" ), "scoreboardAddColumn", "elementDataName", 70, "Your Column Name") -- elementDataName -> the name of the elementData you will use, eg. if you already have something like player:aliveTime, you add that string here, this will not be visible on the scoreboard -- 70 -> width of the column -- "Your Column Name" -> the name of the column that will be shown on the scoreboard for k, v in ipairs(getElementsByType("player")) do setElementData(v, "elementDataName", math.random(1,50)) -- make sure players actually have the same elementData as you set in the column end
  17. So for example you have a list of cars "Mercedes", "BMW", "Audi" in the GridList, but you want to get their 'actual' data assigned to them e.g. "Mercedes" -> "Sultan", "BMW" -> "Washington", "Audi" -> "Admiral"? If so, that'd be a good idea.
  18. pa3ck

    can't store data

    What do you mean by not "sotring" the data? (sorting? but that wouldn't make sense either..) What is happening/not happening, any errors in debugscript? And you don't have to create an actual object to save the element data, you can create a static "element", with createElement, although using table would be just fine, you just didn't know how to use them. To insert data into a table use: local myTable = {} table.insert(myTable, "myString") --> [1] table.insert(myTable, {"mystring2", "mystring3"}) -- [2][1] AND [2][2] because I added a table inside the table using { } myTable["myKey"] = "myString4" -- ["myKey"] here you access the data with a string key, not a number as in the previous 2 outputChatBox(myTable[1]) outputChatBox(myTable[2][1]) outputChatBox(myTable[2][2]) outputChatBox(myTable["myKey"]) --[[Output: myString myString2 myString3 myString4 Table looks like this after insert: local myTable = { "myString", { "myString2", "myString3" }, ["myKey"] = "myString4" } ]]
  19. People have different opinions.. you might think this is the most important feature, while other people would say it's not even needed... You can replace upgrade parts with the vehicle model and use shader to change their texture, there is no limit on how many types of shaders you can have. Changing model variants is also an option.
  20. pa3ck

    can't store data

    What are you trying to do? Why do you want to set the element data of a LUA table?
  21. Since all the other DxGui libraries are outdated / abandoned, I think many people will decide to use yours. Are you sure you are not willing to make an English documentation? A wiki page like this: https://wiki.multitheftauto.com/wiki/Slothman/Slothbot
  22. This actually looks pretty neat, finally a usable dxGui library, well done.
  23. That would actually be a really nice event to have, you can do it with a timer or script whenever you change the interior/dimension for the player, I know... but still.. could come handy
  24. Looks like the problem is with your email? 'Note: Missing or incorrect owner_ema' (owner_email_address). What if you remove your email?
×
×
  • Create New...