Jump to content

madis

Members
  • Posts

    247
  • Joined

  • Last visited

Everything posted by madis

  1. It should be all of these, I guess. If the rope has been shot just in front of you, there's no z though. Even if I don't set Y velocity, it should still move in the right direction on one axis, imo. But while testing I got the opposite direction quite often.
  2. Hi, I'm trying to do a 'ish rope for fun. I'm a bit stuck on having a quality method to move the player on the rope.I got somewhat OK result by changing Element position with interpolateBetween. However, it might be nicer to use setElementVelocity, because it would allow to let go from the rope and still have some velocity left (you can see usefulness of that in the Liero video). Also it would solve the problem of going through objects. The problem is, that setElementVelocity seems to throw the player in quite random position. local a,b,c = getElementPosition(localPlayer) x_target, y_target, z_target = unpack(g_Rope.targetPos) -- This one actually works, got it from someone else's script wanted_ped_angle = (360-math.deg(math.atan2(( x_end-a ),( y_end-b ))))%360; setPedRotation(localPlayer, wanted_ped_angle); -- These don't seem to affect the velocity behaviour, so commented out: --setPedLookAt(localPlayer ,x_end, y_end, z_end, 0) --setPedAimTarget(localPlayer ,x_end, y_end, z_end) -- There seems to be a problem moving the player when on ground, so let's give a lift if isPedOnGround then setElementPosition(localPlayer, a,b,c+1, false) end setElementVelocity(localPlayer, 0.2, 0, 0) It does move the player if I'm not on the ground, but it seems to move the player in random position. Should I change the parameters in setElementVelocity? Are there anything more than speed in these actually?
  3. Why didn't you put the decreased loading time in?
  4. Doesn't matter, the server still sents the time every second to everybody behind the scenes. But if you see no issues while testing, then let it be like that.
  5. It's better to print the time client side only, while keeping the actual ending on server side. If it will be a long time, there could be a time sync once in a while, though it's not problem for usual computers to have 1 second accurate counters for at least a day. Though client computer could have some malfunction, or something sucks the resources temporary.
  6. madis

    Alpha Set :D

    Is wndShop global?
  7. I'll be an ass and not read your last post, as I just got ready with an example how I would implement a draft (and later refactor it into something more re-usable). I haven't coded in Lua for half a year, so there are probably errors, but it doesn't matter. function setVehicleHeadLightColorWithUndo(vehicle, r, g, b) --get for undo local oldR, oldG, oldB = getVehicleHeadLightColor(vehicle); --keep for redo local action = setVehicleHeadLightColor(vehicle, r, g, b) local undoAction = {setVehicleHeadLightColor(vehicle, oldR, oldG, oldB)} addToActionsHistory(action, undoAction) end -- global undo table actionsHistory = {} -- ... in arguments list is a valid code in Lua, which means any extra arguments when method is called function addToActionsHistory(redoAction, undoAction) local undone = false local methodInfo = {redoAction, undoAction, undone} table.insert(actionsHistory, methodInfo) end function markAsUndone(index) local methodInfo = actionsHistory[index] -- undone = true methodInfo[3] = true -- Can't remember if it's pointer or we need to overwrite the old table element with new data in Lua... end undo(steps) { -- default value for steps if steps==nil steps=1 end for iterator, methodInfo in ipairs(steps) do local index = #actionsHistory-iterator-1 markAsUndone(index) local methodInfo = actionsHistory[index] local undoAction = methodInfo[2] -- not sure if it was that easy in Lua undoAction() end } redo(steps) { -- default value for steps if steps==nil steps=1 end --TODO: Implement it --check if undone from the end first... --local redoAction = methodInfo[1] --redoAction() }
  8. You can think of undo/redo system a bit like revision system. Of course you need to do a lot of extra work (you need to have a reverse method), so think if you really need it. Also in MTA resource, why do you need it exactly? If it's something mutual for clients on serverside (like in the map editor?) then it adds another layer of complexity, which I would never want to deal with (programming). However, this is a very good topic. I have thought on that myself too. I'm sure there are some nice articles out there, but discussing these things by self is also fun.
  9. Every action needs associated reverse-action. Then store all the actions done in the right order.
  10. Just throwing in a nice alternative: http://librocket.com/ Seems to have better documentation and some nice API methods, but I doubt we can use e.g gradients or a lot of cool html5, css3 stuff. afaik, the mouse position reading fps for webkit is 100fps. Generating, moving javascript dialogs also seem to be quick. Exactly
  11. I have no idea about the performance or size. It should be similar to using Chromium, I assume.
  12. As I stated in feature request #0003314, which discusses whether to replace CEGUI with something else, Awesomium seems to support embedding Webkit engine. Using Awesomium javascript mapping, MTA could get feedback from the GUI, so it is possible to it should be possible to use it. Why html, js and css? It would be a lot nicer to make GUIs in html instead of writing functional or object-oriented code. Of course, for backwards compatibility, all current GUI methods need to be supported, but that's also doable. Just a quick example, what this mixture of javascript created UI elements and normal DOM elements code would produce (the code does not represent how a normal UI should look): <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Example</title> <link rel="stylesheet" href="../css/smoothness/jquery-ui-1.8.9.custom.css" type="text/css"/> <link rel="stylesheet" href="../css/mta.css" type="text/css"/> <script src="../js/jquery.js"></script> <script src="../js/jquery-ui.custom.min.js"></script> <script> $(function() { //$('#dialog').dialog().dialog('widget').position({ offset: '250 50', of: $(this) }); var myWindow = createWindow(200, 30, 500, 500, "Server Browser", 0); var tabPanel = createTabPanel(myWindow); }); function createWindow(x, y, width, height, title, isRelative) { //var emptyDiv = $('<div></div>'); //$('body').after(emptyDiv); var emptyDiv = $('#tabs'); emptyDiv.dialog({width: width, height: height, title: title, position: [x, y]}); return emptyDiv; } function createTabPanel(myWindow) { return myWindow.tabs(); } </script> </head> <body> <div id="tabs"> <ul> <li><a href="#tabs-1">Internet</a></li> <li><a href="#tabs-2">LAN</a></li> <li><a href="#tabs-3">Favourites</a></li> <li><a href="#tabs-4">Recently Played</a></li> </ul> <div id="tabs-1"> <p>This is a server browser</p> </div> <div id="tabs-2"> <p>Lan</p> </div> <div id="tabs-3"> <p>Fav</p> </div> <div id="tabs-4"> <p>Recent</p> </div> </div> </body> </html> This topic was made just for discussion for using Awesomium (or anything similar) as I didn't want to spam the Mantis.
  13. Unfortunately you can't simply use attach method to attach it (you could add a feature request for that in MTA). You need to add handler method for a render event, and update the sound3d element's position on each call of that handler method. You can get the required position from the vehicle. Update: As SDK noted, it is possible to use attachElements method. I guess I was a bit behind of time with having the deprecated attachElementToElement in mind.
  14. I don't think that developer's time should be consumed on making weekly tutorials. I do agree, there should be a quickstart resource/gamemode tutorial for newcomers. It's always hard to catch everything without a good minimal example.
  15. afaik it's disabled temporarily because of some problems with it
  16. math.random itself doesn't offer such functionality However, it's easy to make a function for that. This takes in array-type table and returns random element from it. function getRandomValue(acceptedValues) if acceptedValues == nil or #acceptedValues == 0 then return false end randomIndex = math.random(#acceptedValues) return acceptedValues[randomIndex] end Example usage: getRandomValue({20,25})
  17. Here's 0.4.5, which adds an effect when you're not inside the car where music is coming from. Also default settings for minimum and maximum distances were changed to 40 and 200.
  18. If you are at it, it would be great if there would be a setting for default radio station (or custom stream).
  19. Here's the version 0.4, which supports streaming. Works only with MTA 1.1 nightly.
  20. It would be better if you would use /start admin and then click P, go to resources and edit configuration instead of directly editing meta.xml. Thinking about the game where the idea comes from, Battlefield Vietnam, the airvehicles could be heared from quite far and normal vehicles too, and it wasn't annoying actually (though the amount of vehicles there is low). You might try raising minimum distance and lowering maximum distance, though.
  21. At last you got it finished, Talidan! Great and needed job!
  22. I will assume that is something with the new sound library same with the old library... EDIT: I have a question, is there a wiki page for MTA 1.1 scripting functions, or did you look at the source code? Cool. Haven't tested the .ogg indeed. Was searching for syntax myself too, but noticed the specific one in mantis bug report. EDIT: Audio functions for Lua are here: http://code.google.com/p/mtasa-blue/sou ... cpp?r=1898 There are sound effects (also, there's doppler effect in bass BASS_Set3DFactors(1,1,1); (//Use meters as distance unit, real world rolloff, real doppler effect), not sure if it's on). Great, will add something that seems more like inside of a car (and maybe get car/vehicle type and have less of that effect for cars without roofs etc). MTA is cool. EDIT2: Also, https://wiki.multitheftauto.com/wiki/Category:Changes_in_1.1
  23. madis

    Two MTA sa clients?

    I got to run multiple gta_sa and mta instances too if killing the \Sessions\1\BaseNamedObjects\Grand theft auto San Andreas handler for gta_sa and similar handler for mta, but of course that doesn't really work, as the game would crash in half way of loading. I tried to edit the gta_sa.exe too, but failed... but it was interesting to do that and learn some new stuff.
  24. madis

    [help] Accounts

    1) Start server from MTA Server.exe 2) Issue the command in server terminal: addaccount <nick> <password> 3) Close server 4) Edit /server/mods/deathmatch/acl.xml and add inside Admin group <object name="user.<nick>" /> 5) Start server again 6) Start the game and when you're in your server issue the command ingame via chatbox /login <password> or via F8 Console login <password> Replace with your ingame name and with password you want. Don't include the brackets and remember that the username and password are case-sensitive!
×
×
  • Create New...