Jump to content

DiSaMe

Helpers
  • Posts

    1,449
  • Joined

  • Last visited

  • Days Won

    32

Everything posted by DiSaMe

  1. .:HyPeX:., don't write if you don't know. KRZO, if you need to sync data (such as money), you need to use the element data or custom events: setElementData getElementData addEvent addEventHandler triggerClientEvent In case of element data, whatever you set (using setElementData) on server or any of the clients, becomes visible for everyone (unless you choose not to sync it using the 4th argument of setElementData), so that the data can be retrieved using getElementData. As for events, you can create an event on the client using addEvent, then add the handler using addEventHandler, and when you call triggerClientEvent on the server using the same event name, the handler function will be called on the client with the same parameters which were specified in triggerClientEvent.
  2. https://wiki.multitheftauto.com/wiki/GetPlayerMoney Client-side: That's it, you're just getting the local player's money, since that's the only thing client-side getPlayerMoney can return because client is unaware of whatever happens on other clients.
  3. removeWorldModel createObject "onClientVehicleCollision" "onClientObjectDamage" createExplosion destroyElement
  4. Replies about useful suggestions within 10 min, because SA-MP has more useful suggestions, since many things people suggest to make MTA are actually already there, such as your suggestions in this topic. When you say SA-MP is better, you're supposed to say things which SA-MP has and MTA doesn't... Hahahahaha. Funny joke, man. Do you realize how they would react to discussion like this on SA-MP forums? Argumentum ad populum. Considering the brainwashing (such as lying to newbies who don't know which program to choose) done to make SA-MP player count as high as possible, this is a strong argument against SA-MP. When you say SA-MP is better, you're supposed to say things which SA-MP has and MTA doesn't... Oh, by the way, MTA allows designing GUIs, and it has always been that way, not like SA-MP, where all you can use is what's already done. Though I've seen a GUI designed using textdraws or something like that on SA-MP, it's not nearly as flexible as MTA GUI because of server-only scripting. Who cares about numbers? Who cares how much time the signal goes forth and back if it's still as laggy as it can be? I once tested the smoothness of player movement on SA-MP and MTA, and SA-MP with ping of 50 ms was lagging as much as MTA with 200 ms. That was back in the days when MTA didn't have as many lag reduction techniques as it has now. With all your "arguments" destroyed, this phrase becomes nothing but faith. You can say "I can feel it in my heart", "you just have to believe it", "many people say it's true, therefore it's true" or "this book says it's true, therefore it's true", but statements without evidence are useless.
  5. All logical arguments are useless in debates against SA-MP fanboys. SA-MP is SA-MP, MTA is not SA-MP, therefore SA-MP rules and MTA sucks. That's it - assumption that SA-MP is better will always lead to the conclusion that SA-MP is better. Although it's possible to use objective reasoning and consider the fact that SA-MP lacks many possibilities compared to MTA, what's the point of trying to find the facts when you can rely on faith? The advantage of logic is that it helps you find the truth. Rejection of evidence, on the other hand, has much more important advantage: it lets you believe whatever you want, no matter how much proof shows you're wrong. Faith will never let you down
  6. Now, that's so funny. You requested something that's already in MTA and not in SA-MP, yet you're saying SA-MP is better, therefore you contradicted yourself, which makes you undisputedly wrong.
  7. Apart from missing commas and usage of variable before it is assigned the function value, this line hardly has any meaning: local dxDraw3DText = exports.3D_DX_Texts:dxDraw3DText This syntax: table:method(arguments) is another way to write this call: table.method(table, arguments) So it's not like 'table:method' has any meaning without a call.
  8. DiSaMe

    createWater

    Coordinates have to be put in the correct order. x1 and x3 should be less than x2 and x4, y1 and y2 should be less than y3 and y4. So the code shoud look like this: createWater(613, -294, 12, 635, -294, 12, 613, -229, 12, 635, -229, 12)
  9. DiSaMe

    Question

    If you don't want the players to carry more than 5 weapons, don't give them more than 5 weapons, simple...
  10. DiSaMe

    save stats

    Wrong, they are defined by the time they are called. No matter where you put the function, it is called when it is called.
  11. if attacker == localPlayer then Therefore the rest of the function is only executed if local player is the one who inflicted damage. And since client-side scripts can only control the health of local player, this results in script actually taking effect if player causes damage to himself/herself.
  12. I didn't confuse you in the first place. Your mind confused you because it tricked you into believing you see DX rectangles, text, images and lines. What you see is actually lots of pixels with various colors on the screen. When DX drawing function is called, colors of some pixels are changed and your mind interprets these combinations of colors as distinct elements, while in MTA, nothing is created. So if you don't want DX drawings to be visible, simply don't draw them when they shouldn't be visible.
  13. There are no DX elements. Such things like "DX elements" do not exist. Therefore they can't be created/destroyed/moved/hidden/linked/whatever. DX drawing functions do exactly what their names say: they draw, that means, the function call changes the colors of some pixels. This change is visible for one frame because all pixels on the screen are cleared, so whatever the function drew is already gone the next frame.
  14. Recording 60 frames per second? What the hell are you going to do with that much? My estimates: 10 players in range Recording at 10 FPS 12 frequently updated values for position, position velocity, rotation, rotation velocity (race gamemode) 10 players x 10 FPS x 12 values = 1200 values per second to write 1200 x 10 s = 12000 values in RAM to store
  15. Traffic is created and destroyed in generate.lua file, spawnTrafficInSquare and despawnTrafficInSquare functions. As for positions on road, you can look at load_paths.lua to see where the data is stored. conn_n1[connection_id] and conn_n2[connection_id] are the nodes where connection starts and ends and if it is bent around a node, that node is stored in conn_nb table. The last thing you want to do, linking/unlinking the vehicles to/from traffic, is not something what this resource was designed for. Maybe you could achieve this if you did the same what is done on creation/removal of vehicles, minus the createVehicle/destroyElement calls (using already existing vehicle instead), but the resource itself is not well-designed overall because I was after speed, not flexibility when I was making it.
  16. I use Arch Linux and I had no problems running MTA on Wine 1.4, but it didn't work for me on Wine 1.5 and 1.6.
  17. Nic062, setObjectBreakable does not do what he wants (getting element from ID) getElementByID
  18. "onClientPreRender" setElementPosition setElementRotation setElementVelocity setVehicleTurnVelocity
  19. Maybe that's because ipairs only iterates over the array part of the table (numeric keys), but the row uses strings as column identifiers? Try iterating using pairs instead.
  20. function callFunctionWithSleeps(calledFunction, ...) local co = coroutine.create(calledFunction) --we create a thread coroutine.resume(co, ...) --and start its execution end function sleep(time) local co = coroutine.running() local function resumeThisCoroutine() --since setTimer copies the argument values and coroutines cannot be copied, co cannot be passed as an argument, so we use a nested function with co as an upvalue instead coroutine.resume(co) end setTimer(resumeThisCoroutine, time, 1) --we set a timer to resume the current thread later coroutine.yield() --we pause the execution, it will be continued when the timer calls the resume function end -----------example----------- function pauseExample(a, b, c) outputChatBox("Started the execution. a value: "..tostring(a)) sleep(5000) outputChatBox("Waited 5 seconds. b value: "..tostring(b)) sleep(5000) outputChatBox("Waited 10 seconds, finishing the execution. c value: "..tostring(c)) end callFunctionWithSleeps(pauseExample, 1, 2, 3) Not tested, but should work. Keep in mind, however, that this exact implementation won't display errors within the called function, because coroutine.resume returns the error as a string instead of propagating it to the caller.
  21. http://www.lua.org/manual/5.1/manual.html#2.11 http://www.lua.org/manual/5.1/manual.html#5.2
  22. You can work with binary files, since you can use string.byte on strings to get the values of bytes. That's what my bytedata script does, though it has problems reading the floating point values, and it's probably because of reduced precision on client, as using it on standalone Lua interpreter gave correct results. Nevertheless, built-in functions for binary file processing would be much faster.
  23. I bet you have the object and player in different interiors/dimensions.
  24. The element is detached from the ped it is attached to. That must be obvious. You cannot attach the element to more than one ped, so there's no need to specify it, since it is already known.
×
×
  • Create New...