Jump to content

subenji99

Members
  • Posts

    264
  • Joined

  • Last visited

Everything posted by subenji99

  1. Another case of learning to debug would prevent a stupid question. You'll find debugscript reports an error on your addEventHandler line that closeButton is a "bad element pointer". (The message may be different, but the cause is the element doesn't exist.) As 50p explains, code is executed sequentially when the resource first starts - as this happens, functions are loaded into memory and can then be accessed (why you would normally put a handler line below it's called function) but lines not in functions are executed immediately. (adding the event handler in this case) Functions don't execute until they are called, either by a line outside a function or by event handlers etc. The assumption here is that you have a function that creates your GUI window - so as the script loads, your createGUI function is loaded and ready to execute, but hasn't been called yet. So your GUI doesn't exist just yet, and any elements created there also don't exist yet and cannot be accessed. Solution is simple, and there are 2 methods to go about it. Move your addEventHandler line that attaches to closeButton into the createGUI function AFTER closeButton is created (remember that functions generally get executed after loading the script so your windowClose function is accessible) or Don't create your GUI inside a function - it only has to be created once after all, you can hide it (with guiSetVisible) instantly, and then all your GUI elements will be accessible anywhere.
  2. You probably should have used the linked discussion page to discuss this.
  3. https://forum.multitheftauto.com/viewtop ... 91&t=25879 Use search next time.
  4. It is your "registry.db" file in your server folder.
  5. The simplest way of doing this would to code a routine where they try to drive to a "point" - accelerate if they're facing towards it, and turn to face it when not. Have this point be the vehicle in front (or just behind that vehicle, to reduce ramming ) This is a crude solution however, as you have to handle the fact that cars cannot turn without velocity - not to mention such a solution would easily be thwarted by a wall and will have issues with corners. Having said that, Slothman has dealt with similar issues when making his zombies, so he's your best bet for help. Of course the near-perfect solution would be both a fully fledged driving AI, that follows a pathing network - this is how Rockstar did it. Unfortunately, MTA doesn't expose access to either (and while it may be possible to expose the pathnodes with some development, certain low-level design choices mean we'll never get access to the AI routines besides someone skilled working on a straight port from the SCM) so unless you have the knowledge and the patience to code an entire vehicle AI yourself, crude solutions may be your best bet.
  6. Most of us use http://sourceforge.net/projects/sqlitebrowser/ for database cleanup from our mistakes. Just don't run it while your server is running.
  7. setElementParent doesn't do anything like "attachments", all it does is move the position of that element in the element tree. All you would accomplish with it is destroying the "parent" car (in script, not blowing it up) would automatically destroy the child cars too. A common use for it would be grouping similar elements - for example you could make a dummy element called "redSpawnpoints" whose parent is a team element, and all that team's spawnpoints are children of it. Then if you needed to access all the spawnpoints in code at some time (say, for respawning), you can then use "getElementChildren(redSpawnpoints)".
  8. Extended from mapmanager example: function loadMap(startedMap) mapRoot = getResourceRootElement(startedMap) local mapVehicles = getElementsByType ( "vehicle", mapRoot ) --start at Map Root Element, we're not interested in other vehicles possibly existing for _, veh in pairs ( mapVehicles ) do toggleVehicleRespawn ( veh, true ) setVehicleRespawnDelay ( veh, 30000 ) --delay in milliseconds, this is 30 seconds end end addEventHandler("onGamemodeMapStart", getRootElement(), loadMap)
  9. While the discussion moved on, I'll point out here that you are getting errors because you are forgetting that tables need to be defined before they are indexed. myTable[1][1] --will error myTable[1] --will also error myTable = {} myTable[1] -- will now return nil (index exists now, but no value has been entered yet) myTable[1][1] --will error myTable[1] = {} myTable[1] --will return TABLE: (memory address) myTable[1][1] --will return nil or you can just do: myTable = { {} } -- creates a double-array table of size myTable[1][1] so remember you need to initialize tables. Also remember however that initializing a table will wipe the table blank too, so initialize the table at a spot that only is executed once, or add: if type(myTable) ~= "table" then myTable = {} end
  10. I'm 99% certain that note is referring to editing the file in a text editor, not using setAccountData. I've used account data several times and not lost any accounts. https://wiki.multitheftauto.com/wiki/Ser ... _functions There are several examples given in those SQL functions, and combined with the SQL Documentation, you should have no issues at all. It's how I learned to use MTA's SQLite.
  11. We wouldn't help you cheat anyway, but just for the record (and to stop you trying), each player's money is managed serverside. You can't modify your cash with any memory editing program.
  12. Actually, this is possible without having to write a whole bunch of code for your own nametags - but with 1 limitation. You have to put your added info below their health bar, not above - or move their name below their healthbar. Using setPlayerNametagText and the \n escape character (newline) you can add extra data to the nametags. It's simple string manipulation. Make sure to run this function serverside to properly sync your changes on every client. If you prefer more control, the Race gamemode creates it's own nametags with dxDrawText, so you could probably learn from that code.
  13. I actually agree with that. We should keep "setPlayerNametagText" as it is, but limit "setPlayerName" to a temporary change, not saved when they disconnect rather than remove it entirely. As for preventing tampering entirely, remember that some servers only want to strip colour codes (especially if they would interfere with a gamemode), or injected spaces in the nickname, or prevent constant nickname changing. I agree there isn't really a need to be stripping symbols and such from player names, but that's not the only consideration.
  14. The reason there are not many roleplay servers is because MTA hasn't had a large roleplay release like SA-MP's "The Godfather Roleplay" script (and if I remember correctly, there was another one before that, too) that anyone can download, modify, and make a server from. Anyone spending the time and effort in making a good roleplay server is keeping the code to themselves. (And quite right, too, IMO) As for difficulty, in their vanilla forms, Lua is FAR easier than PAWN. Having said that, there are lots of nuances involved on coding for MTA (server vs client, element tree, event handlers and their attachments and hidden variables, conflicting resources) that take a lot of research and experience to fully understand. They're logical in their behaviour though, and offer incredible power to your code, so stick at it, experiment, and you'll understand the quirks in no time.
  15. Most likely reason is a server has an auto-renamer for anyone who joins as "Player". Just take it as a noob label.
  16. In an odd twist of irony considering what you are trying to accomplish, setElementVelocity behaves oddly when used on peds that are on the ground, but works perfectly fine once airborne. (I see the behaviour as peds on the ground are completely restricted to movement by animations only. Set velocity only works for a single frame.) You should be able to solve this by applying the velocity a second time, 1 frame later (via onClientRender, or a timer if serverside - but the timer will be less reliable) as at that point the ped should be airborne.
  17. Excellent work, I love it! I'm really glad to see this coming to fruition, and you guys deserve extra congratulations for the effort involved in figuring this one out! Do you have any details on syntax so us impatient fellows can get to work on scripting some handing framework functions prematurely? I see: --clientside bool setVehicleHandlingData(element vehicle, string handling, int/float value) Are the handling strings the same as in the handling.cfg file, and are there any other functions? Thanks for the info! (not worth another post in my opinion )
  18. Lua isn't PAWN, you can define an array anywhere.
  19. subenji99

    Votemanager

    Sounds like your gamemode forgot this bit of code: Submit a bug report if this is a MTA provided resource.
  20. I was going to stay out of this, but your idiocy forced my hand. 1. Cannot reproduce. AT ALL. The vehicle change pickups work every single time on our Race/DD server. If there was a problem with say, stacking them, for that damned "teleport" behaviour, SPECIFY THAT. 2. MTA:MA was NOT made by the MTA developers. Not an issue. You want something like that, make it yourself or pay someone to do it for you. 3. This is SO DAMN EASY, even for a beginning scripter, that it just shows ignorance on your part. 5. MTA's current 3-tiered system works FINE for most servers, but the system is SO configurable, you can set up any system you like with it. You don't like it, take some time out of your life to set it up ONCE, and then you'll be happy. 6. Using the Admin panel REQUIRES some intelligence and common sense. If you can't control yourself and your Admins from abusing the Admin panel, you shouldn't be running a server. 7. A race is only delayed by up to 30 seconds waiting for people to download, then starts whether they are ready or not - and this behaviour is easily altered in the code if you want to change it. Besides, the whole point of that behaviour is a race is no fun if very few people actually start the race on time, and the majority are still loading the map/gamemode. Learn some damn patience. And as mentioned, apart from the maps themselves, you only have to grab these resources ONCE per server, then you never have to sit through it again. Not an issue. Grow up, do some research for yourself, and stop acting like the MTA Team owe you a damn thing.
  21. subenji99

    Votemanager

    As mentioned, the solution is likely to be accomplished by not running votemanager at all and using mapcycler - however, as I'm not even aware of a single server that works this way, your best guide to setting this up is the mapcycler wiki page. https://wiki.multitheftauto.com/wiki/Resource:Mapcycler
  22. I understand your opinion here, but adding in extra scripts as part of a race map is actually incredibly easy to do, and not really worthy of examples. no special methods/requirements are needed, just adding the script in the map resource with appropriate meta line or making up a seperate resource and an include meta line in maps that will use it.
  23. The immediate problem would be collision groups are not supported by MTA - specifically, if you have a .col file containing multiple collision sections, the .col file will fail to load. Simply split each group into it's own .col file (this is a simple task with CollEditor) and edit your script/meta to match and it should work. MTA can load all 3 formats of the .col format, it just needs each group in it's own file, so you shouldn't have any more issues with it. EDIT: Oops, should have looked at your picture first! Your colshape is already correct. I'll leave this info here for posterity. Have you remembered to assign the colshape to the correct model ID? are you replacing the model dff last? txd = engineLoadTXD("txdfile.txd") engineImportTXD(txd, 5000) col = engineLoadCOL("colfile.col") engineReplaceCOL(col, 5000) dff = engineLoadDFF("dfffile.dff", 0) engineReplaceModel(dff, 5000)
  24. It is possible to send too much at once, but such data would be so considerably large that it would be a simple matter to split it up then. I'll give an example from a script I was working on recently - I formed an array containing every gamemode (and it's "friendly name"), with a sub-array of every map compatible with that gamemode (and it's "friendly name" too) for sending to the client for a GUI. (getResourceInfo etc. functions are server-side only) With 10+ gamemodes and over 400+ maps, some of which are used in multiple gamemodes, that made for an incredibly large array, and was too much to send. Such a large array was easily split by only requesting the gamemode list, then when a gamemode was selected, request the map list for just that gamemode. Even with 600+ individual race maps, this has been handled fine. Basically, you can send very large arrays without issue, but not insanely large - which you'll be more than aware that it's too big if you attempted to!
  25. subenji99

    English servers

    The Pothole Studios servers have a heavily-enforced English-Only rule - to the point that you have to prove you can speak english before your chatbox is made available. However, it's not proved to be very popular. The rule is unlikely to ever be changed however, the clan leader is quite set on the rule. (A new system for dealing with non-english players that isn't so harsh is being considered.)
×
×
  • Create New...