Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. Thinking about it, yes. This is fairly simple if you're hosting on a linux server. Simply create a php scripts or even an API for your own server which uses exec to run linux commands, create different calls to either commit, merge, pull, or do what ever you want. simply execute these linux based commands and you're fine. On a windows server this'll be a lot harder, even impossible I guess. You'll have to go to great lengths to achieve that
  2. First of all, you're not even checking if you got an object. Does your console say something about it? Second of all, always detach an object before trying to destroy it. It's not going to work without. function destroyObject ( theElement, matchingDimension ) if ( theElement == getLocalPlayer() ) then local tmpObject = getElementAttachedTo ( source ); if ( tmpObject ) then detachElements ( tmpObject, source ); destroyElement ( tmpObject ); end end end addEventHandler ( "onClientColShapeHit", getRootElement(), destroyObject );
  3. I'm not sure, I haven't done this at all in MTA yet but try to make the values in your theFunctions table non-string based. Why would they use a string to call a function?
  4. There is a way to make it cleaner, that is for sure. Try something like this; local tmpColshape = nil; addEventHandler ( "onClientColShapeHit", getRootElement(), function ( theElement ) if ( theElement == getlocalPlayer() ) then tmpColshape = source; addEventHandler ( "onClientKey", getRootElement(), setItemData ); end end ); addEventHandler ( "onClientColShapeLeave", getRootElement(), function ( theElement ) if ( theElement == getlocalPlayer() ) then tmpColshape = nil; removeEventHandler ( "onClientKey", getRootElement(), setItemData ); end end ); function setItemData ( button, pressed ) if ( button == "mouse3" and pressed ) then local tmpObject = getElementAttachtedTo ( tmpColshape ); setElementData ( getLocalPlayer(), "item", getElementData ( tmpObject, "item" ) ); removeEventHandler ( "onClientKey", getRootElement(), setItemData ); end end Maybe it's also smart to see if the colshape has an object attached to it in the onClientColShapeHit already. To avoid warnings and such.
  5. Well I've been trying that too, but that didn't really work out. If it does, that also means that you have to rebind actual other functions on that key with chatboxes. Correct?
  6. Please do know that this will cause lag if your sql server is working really hard. Lets say.. if a lot of people are logging in at the same time. I would rather use a callback for this, like so: function spawnOnLogin () dbQuery ( function ( queryHandler ) local result = dbPoll ( queryHandler, -1 ); if ( #result > 0 ) then local skin = result [ 'skin' ]; local cash = result [ 'cash' ]; local waswanted = result [ 'waswanted' ]; end end, "SELECT * FROM `player_stuff` WHERE `name` = ?", getPlayerName ( source ) ); end addEventHandler ( "onPlayerJoin", getRootElement(), spawnOnLogin ); Especially since it's onPlayerJoin, you should use callbacks like that.
  7. To create a blip, the server needs a function 'createBlip'. The wiki states; blip createBlip ( float x, float y, float z [, int icon = 0, int size = 2, int r = 255, int g = 0, int b = 0, int a = 255, int ordering = 0, float visibleDistance = 99999.0, visibleTo = getRootElement( ) ] ) The visible distance is simply how far you can be away from it for it to work. If you want to do it the easy way; search every file (use an editor like notepad++ for this) to add the distance to every blip.
  8. I've been working with binding keys quite a lot, but this is currently destroying my brain. Lots of other people have been walking against this problem and I'm trying to find a solution, it can't be that hard! My setup is as following: User gets a UI -> fills in a key to bind a chat to -> using triggerServerEvent to bind the key for the user + some sql saving After a successful attempt of saving the new button for the user, I'm trying to unbind the key from the chatbox-styled function isn't unbinding. If I'm simply unbinding it with runcode directly in runtime, it's returning a true but it's not unbinding. I've seen several reports about this on the bugtracker but none of them were taken note off. Is there a work around or should I simply ask my users to use a MTA-based command to unbind their keys? thanks in advance.
  9. The script makes like.. seriously no sense. You're overriding the data in 'itens' before you're even saving it. Why would you ever make it like that..? It's quite simple. The fact that it's not saving is because you're not even taking the effort to see if you got an error from your query. You're simply firing the query and hoping it's going to work. First of all, 'tentItensTable' holds data from a collision. 'thecol' hasn't been defined inside this snippet so I think it's declared somewhere else in the document. If not, then you're basically passing invalid data to your database which would crash right away, check your data, debugscript and also use DbPoll to see if you get a message about the actual warning.
  10. tosfera

    The last reply

    Kinda hate it. Sure, it's plain and that makes it a bit more readable but then again.. the color-scheme is totally a mess, the header totally destroys the clean side of the forum and lots of things are missing.
  11. The error is telling you that 'sha1' is not a known thing. Most likely it's because sha1 isn't a function in your script. As an easy thing to do, you can just download the most known sha1 library out there made by kikito on Github. https://github.com/kikito/sha1.lua/blob/master/sha1.lua Make sure the script can access the file and it's able to use the function.
  12. use onClientKey or onClientCharacter. They'll trigger once a player presses a button. Just add them to the function removeAFK.
  13. function frozeMarker (thePlayer, freezeTime) local players = getElementsByType ( "player" ) setElementFrozen (players, true) setTimer ( setElementFrozen, 3000, 1, players, false) end addEventHandler ("onMarkerHit", root, frozeMarker) This is not working to ;( Try this: function frozeMarker () for i, players in ipairs(getElementsByType("player")) setElementFrozen (players, true) setTimer(setElementFrozen, 3000, 1, players, false) end addEventHandler ("onMarkerHit", getRootElement(), frozeMarker) You're joking, right? You're freezing everyone in the entire server.. clearly OP asked for only 1 person.. This is all you need @OP local marker = createMarker ( 0, 0, 3, "marker", 2, 255, 255, 0, 255 ); addEventHandler ( "onMarkerHit", marker, function ( thePlayer ) setElementFrozen ( thePlayer, true ); setTimer ( setElementFrozen, 3000, 1, thePlayer, false ); end );
  14. tosfera

    help

    you can use stopResource to stop all your resources, you should do it 1 by 1 so they get shut down normally and the event onResourceStop will be called. Save all your data in there, if needed. After that use shutdown to turn the server off.
  15. I'll just force Blast3r to work on them a bit longer then.
  16. Found any information about this? We're still having mixed feelings about bike handlings. Most of these handlings for bikes, which should be enabled after giving the correct IS_BIKE flag, aren't being set nor return anything. I'm starting to think that the MTA devs didn't include these properties in the source.. http://web.archive.org/web/201402231602 ... s/handling ( scroll down to the bike variables )
  17. Nope, but whenever I was clicking, I added the new eventhandler. Which resulted into 80 handlers after a while, 80 handlers on every pixel that gets moved around by the script is pretty... stupid.
  18. Actually removed the entire thing, we still have a massive if-statement there. onClientGUIMove is being seriously SPAMMED. Just removed the handler once it has been detected as a move, turned it as isDragging and removed the handler once the button goes up again, so it's isDragging = false. Works perfectly.
  19. I got a setup which has around.. 1 global table, 12 sub tables. even if the subtables are empty, it fucks up. Most likely the tables will be filled with 5 or 6 tables which only hold properties. first thing I'm doing is setting every subtable to nil, after that I'm clearing the entire table saying: Impossible, it's a GUI element which serves as a placeholder, offsets are depending on that. Moving this element would move the rest. just the simple onClientRender with dxDrawText, dxDrawRectangle, and dxDrawImage. edit; Problem found, I had a really ugly handler over here: addEventHandler ( "onClientGUIMove", getRootElement(), function() isDragging = true; end );
  20. First of all, if you're not that experienced, don't bother reading. I got quite some knowledge in the overal package since I'm a programmer for a living, no offense but most new borns might break their heads. So, after quite some hard work being put in a system of mine I managed to find out a possible leak after aggressively spamming a button. To sketch out what I'm doing; I got a table; tmpTable. This table is holding at least 12 sub tables which will be filled with... more tables. Besides those sub tables I got 12 properties in the main table, the subtables all have around 7 to 12 properties. Nothing special. Through my code, I've been using collectgarbage('count') to see what the script is doing, at a clean restart of the resource it is around 400-420. Counting up to max 530. After around 30-40 actions, it peaks to a good 800/850. Making your FPS drop a serious amount. I went from 100 fps to a good 45. The script is drawing something depending on the location of an earlier created element. So lets say we got an element created on the screen at 0.3 and 0.5. The next element has an offset of 0.05 depending on the 0.3. so it'll be drawn at 0.35. Once the action stops, it'll clear all the data, the entire table and everything there is. Yet there is still something going wrong and I would love to know what I can do to test where it is going wrong. Things I've tried so far; clean the data every action the user does, doesn't really work. Log the results of the user to see how much memory the user uses ( peaks to 800/850 after 80 actions. ) Not move the element, so no action taken if it's being drawn ( This is a success, the fps won't drop if it's not moving ) keep the element moving at all times ( RIP fps after 80 times... ) log the sizes of the tables after clearing them all ( they're all empty.. ) I'm kinda mind blown about the usage of the memory which happens after 80 movements. ( element moves whenever I click somewhere, so after clicking 80 times it just gets messed up BADLY. ).
  21. Yes it does but all it does is messing up the handlings like a total retard.. there should be anything that messes it up but after hours of trying, my team couldn't find out what.
  22. Howdy fokes, I've created an editor for my team to create vehicle handlings but we've had several issues with handlings for bikes. I've been trying to access the bike flags and handlings but failed miserably. The wiki states only handlings for cars and accessing other flags is either not doing anything or just failing by returning false. Do you guys have any idea on how to access these handling propperties or which ones go for bikes?
  23. I've had this problem too. If you spawn a seriously sh*tload of vehicles, some would get their position desync and just randomly pop-up somewhere else. This is caused by creating vehicles in an area with no one in that area. Simple fix; teleport an administrator towards your shop when the script starts. This'll stop this from happening.
×
×
  • Create New...