Jump to content

Mr_Moose

Members
  • Posts

    866
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Mr_Moose

  1. Alright, you're passing the account name as a string to the getPlayerGroup function which expects a player element, the player element should be in hitPlayer but we can't be 100% sure of that, so here's what you have to do: Replace line 2 from this: if not hitPlayer then return end to this: if not hitPlayer or getElementType(hitPlayer) ~= "player" then return end This way it's 100% guaranteed that hitPlayer is a player element. Then change line 7 from this: local gang = exports["SAEGGroups"]:getPlayerGroup(playerAcc) to this: local gang = exports["SAEGGroups"]:getPlayerGroup(hitPlayer)
  2. 1.6 will only provide these two functions currently: bool setTrainTrack(vehicle train, int track) bool getTrainTrack(vehicle train, int track) Although you can control which track to spawn in you can't control where on the track your train will spawn currently. Take the two main tracks as an example if you are in San Fierro and switch the tracks from there you'll end up at a random location on the other track. These two resources provide sample code to illustrate the issue as well as temporary solutions to them: GTWtrain and GTWvehicles. What you can do is to position all cars you want to attach to your engine after your engine before attaching them by using math.sin and math.cos and the distance 20. This seems to work for up to 15 cars, more than that could still cause them to end up in different tracks. You can also prevent the cars from streaming out, which you would need to do anyway for trains longer than 8 cars as streamed out train elements tends to end up in a different track.
  3. If this is line 430: local g = getElementData ( player, "Group" ) or "None" Then the error occurs where you call this function: function getPlayerGroup ( player ) To solve this, look for something like these: getPlayerGroup("oussama") getPlayerGroup(getPlayerName(player)) This function expects a player element to be passed but instead you send a string of what looks like a player name. If you can't solve it yourself post the part where getPlayerGroup is called.
  4. Core system has been added (GTWcore), the system that manage all account data, some spawn related features, afk and location commands, staff advantages, playtime, freeze players with high ping and much more. It's closely integrated with GTWaccounts which have lead to many issues and has probably also been the strongest argument against this game mode. In any case it's now partially rewritten, patched and added to Github. I would like to thank all the contributors and beta testers for all the help with improvements, optimizations and patching, this means v3.0 is very close to a official release. As mentioned earlier v3.0 means a fully working complete game mode that runs standalone with all features a typical RPG server needs. If everything goes as planned the v3.0 release will occur a few days before Christmas.
  5. Pairs is generally used when you want to process a list of elements but doesn't care about their order, you're right about the first example, it does loop through all 1000 entries. However, you can stop that after 25 entries with an else statement saying "break". Last option is better tho as it only handles the counter and then access the table while the first one needs to store the whole table, assuming you want the data to be in order as well the second option looks even better. But about your specific examples, outputting 25*60 lines in chat box each second is going to be extremely slow no matter what.
  6. News for this week are that SSL support has been added on our websites for improved integrity and increased security, more details are found here: https://forum.404rq.com/index.php?topic=1936.0 Updates this week Increased turfs alpha to improve their visibility Added the command /protecttrain [1/0] for server administrators to enable/disable train derailments for trains of any size Fixed an issue with rental vehicles cleanup system Fixed incorrectly rounded amount of turf money earned in information message Fixed an incorrect file path in GTWtrainhorn making the horn fail on the brown streak engine Disabled derailment completely for train bots Hide player blips in jail for guards, prisoners will still see the guards but the guards has the advantage of using weapons so this should hopefully make everything more balanced. Added /claimturf for server administrators to quickly claim the current turf area Corrected the warning message displayed to drivers of a locked vehicle when another player tries to enter Added the prison restaurant to the restricted area of the prison to prevent swapping weapons inside and most important, to prevent armored robberies committed by prisoners. Removed the vehicle check on gate close to allow gates to close even when a player is passing it in a vehicle (bug)
  7. SQL injections works on SQLite too, in both cases you just need to escape the input string and get rid of symbols like these: '=&"*?}{ just to mention a few.
  8. Depends what type of data you want to store, stats and gameprogress could be stored in a MySQL server obviously, the advantages of that is the ability to sync data across multiple servers without having to rewrite anything, it just works and the simplicity in case you wish to show your players stats online on a php powered website for instance. For data related to elements that needs to be accessed on many different places (server/client/shared) element data is the obvious choice, if I remember right it's also cleaned up from the memory as soon the element is destroyed, otherwise that functionality can easily be accomplished by a single function triggering on element destroy bound to root element. Account data and execute SQL query functions is actually those built in SQLite databases register.db and internal.db. Just like MySQL it's a quick and efficient way to store large amount of server side data. SQLite can only be used by one process at once as it's stored in a local file so use it only if you don't plan to access the data from any other service or server than your MTA server. XML is slow but could be useful for client side settings, for instance if you have a login panel with a checkbox "remember me" you could save the data from the two edit fields in an xml file, encrypt the data first for secure storage or keep it unencrypted to solve the problem with lost passwords in a basic way.
  9. Patches has been released for some known bugs, more details...
  10. Introduction GTW-RPG is the most advanced open source RPG/CnR/Turfs/Jobs/Basic role play game mode started in early 2012, the main goal has been to write something unique, but still not too confusing for players used to other game modes, defining themselves as "RPG". The strict coding guidelines ensure that the code is easy to read and understandable even for people with poor knowledge in Lua scripting. It's also one of the most optimized game modes with this amount of features available, as it was initially developed to work on 20 years old hardware. The project is licensed under the BSD-2-clause license so you are free to download, modify and/or redistribute the full project (or parts of it) as long the original authors names written at the top of each file is left untouched, these are found at the top of each file. Like most open source projects it's available at Github which also makes it easy for anyone who would like to contribute to the project. Back in the past I used to post a new topic for each resource within this game mode, today there are so many resources that it's better to gather them all in this topic including updates, suggestions, bug reports and other news. Download To download and contribute use: git clone https://github.com/404rq/GTW-RPG.git Or visit the project home page to get all the files in a zip archive github.com/404rq/GTW-RPG Useful links: Community support, feedback/suggestions/contributions and bug tracking. discuss.404rq.com/t/suggestions discuss.404rq.com/t/issues Screenshots A collection of 100+ pictures summarizing the game mode can be found at our image hosting site WussIMG wuss.pw/am/F Features The goal is to setup a wiki on Github for full documentation, that means below information is just a quick summary of some of the more important resources included and what they do. Check out Github for more details. GTWaccounts: Graphical login and registration system. GTWanimations: A GUI to choose between all available GTASA animations including some bind able commands. GTWchat: Chat system which adds new chats, supports longer messages and displays chat bubbles GTWcivilians: A system to maintain civilian jobs, GUI to choose skins, tools and display information about the job as well as adding markers where the players can apply for the job. GTWcore: Includes all the core features, saves and load account data such as position, team, weapons, stats, health and much more from internal, SQLite or MySQL databases. It also provides core features such as dealing with lagging players, allow players to go afk in a different dimension adding AFK tags to their names, some location coordinate features, account management and global stats. GTWfastfood: Allow your players to buy fast food in one of the 35 restaurants around San Andreas, including some drive thru's and possibility for players to sell fast food from Mr.Whoopee and the hot dog van GTWgates: Adds gates for bases restricted to team, group or occupation. Gates can always be opened by staff. GTWstaff: A resource to pass ACL groups as a table to clients so that other resources can verify ACL rights in a safe way and find out if a player really is staff or not. GTWhelp, GTWupdates: GUI for in game manual and update news downloaded live from https://www.404rq.com GTWjail, GTWjailmap: Jail system with exported functions, law enforcers and staff can jail players for a certain amount of time, the time is displayed on the client screen and saves if the jailed player tries the classical trick of reconnecting. GTWpolice, GTWwanted: Allow players in the team Government to arrest players with wanted level, wanted level system that allows more then 6 stars (infinity) and adds a level of violence to inform the law enforcers if they can perform a kill arrest or if they have to use their tazer and stick to arrest. GTWphone: Listen to local radio stations, send SMS to other players, (up to 1024 chars instead of just 128 as the chat is limited to). Or call for services GTWtopbar: Used by almost all resources, displays DX messages at the top of a player's screen and fade them out after a while. GTWtrain: Spawns trains controlled by bots on the server, a perfect way for criminals to escape the law, block the way in a police chase, or to travel to another town quickly. GTWvehicles, GTWvehicleshops: Adds over 200 markers where rental vehicles are available at fair prices used to work or to just cruise around. Vehicle shops where all kinds of vehicles can be bought, (including trains) as well as smart GUI's to manage everything (lock, engine, fuel level, damage control, door control, search filet and much more). GTWtraindriver, GTWbusdriver, GTWtrucker, GTWfarmer, GTWfisher, GTWironminer, GTWmechanic, GTWtramdriver: Some of the civilian jobs available, GTWcivilians and GTWvehicles provide these jobs with application GUI and job vehicles. These are the missions within the jobs. GTWhospitals: Respawn at nearest hospital when you die, without loosing your weapons or other important stuff GTWsmoke, GTWrob, GTWweather, GTWplayerblips, GTWsafeareas, GTWtrainhorn, GTWturnindicators: Some of the best misc features. Check them out on Github for more details. For more details, check it out on Github, feedback, suggestions and related comments are welcome in this thread. Demo server A demo server where you can test GTW-RPG live can be found in our community at the following address: mtasa://par-fr.404rq.com:22004
  11. You may want to take a look at this example which builds a server side multi dimensional table of ACL rights in this case, and pass it to clients individually using triggerClientEvent(). I don't think that Lua supports pointers like in C. Instead you'll have to pass the variables. If you can't pass tables you could always convert them to JSON and pass them like a string and then convert them back maybe.
  12. Blips are provided by a default resource named "playerblips", to get into some kind of stealth mode you could use a modified version of that resource, like this one which hides your blip as soon the element data "anon" is set to true, making it easy to maintain. Although it's not exactly what your looking for it's fairly close to it. setPlayerNametagShowing Can be set at the same time as the resource decides whether to hide or show the blip, and that's pretty much all it takes to accomplish what you're trying to do.
  13. That's true, although you would also get all the relative stuff in one place which is an advantage as well.
  14. The most efficient way would be to find the createVehicle function within the race resource and add the white color as parameters to that, (or set the color directly after it's created). Try an editor like Atom from Github which let's you search through multiple files at once.
  15. Changing your password is the best thing you can do right now, hash functions are made to be extremely fast to calculate so using them to secure passwords aren't smart at all. Still tho, most forum software does exactly that including phpbb, mybb, smf etc.. Generally, the longer password you have the longer time it takes to crack it as a cracker needs to try all combinations, a few examples can be found here: https://hashcat.net/oclhashcat/#performance. To crack all passwords built by 6 characters you would only need a couple of seconds on a normal gaming PC. If the cracker used to mine bitcoin he'll probably crack all passwords a hundred times faster. So at this moment he's probably done cracking all the passwords here, although I don't think it's a big threat for the average members as the cracker can't do much more than post or edit some details, the important thing is that all administrators and moderators around here update their passwords.
  16. You're doing it the wrong way, this will send the variable serverName (value: nil) from client to server, then you'll create a new local variable serverside where you get the server name. Take a look at: triggerClientEvent
  17. That sounds very interesting, I did notice how perfect the train "streamed in", passed then disappeared from my sight far away. That part surely works better than my version, seeing it live with multiple players around would be even more interesting. But why setting position instead of train speed? doesn't that mean that you have to calculate a lot to find out direction, next node on the tracks and so on? As far as I know all trains follow nodes on various distance placed along the tracks and when a new train are spawned it spawns at the nearest node, maybe it spawns between nodes as well. When it comes to peds, I was inspired by the bot system by Crystal which controls peds and cars. As it seems to be using peds to control the cars they move just as smooth as if a player would have driven it. The main problem here tho is the element syncer as all moving objects in MTA has a so called "syncelement" which is a player, if this is a player with really high ping then all the cars start to lag and sync terrible as well. There's a function to change the element syncer tho but I don't know if it always overrides or if its ignored as soon another player get's closer to the object or something like that. An improvement for the sync may be to force the nearest player with lowest ping at the moment be the sync element for the train. That kind of stuff could probably be set in onClientPreRender if it doesn't use to much CPU. I believe you about the timers, those where implemented from the beginning and is now the core of my system so solving that would require a complete rewrite of the system. I'm still using timers for some stuff but those should be running with a few seconds delay and not be used for any of the sync stuff. Although, clients usually has better CPU's and they only have to calculate their own data so building the sync stuff client side is probably the best solution so far. In any case I'm really looking forward to see the final version live. Good luck.
  18. You probably misunderstood my point, I'm not complaining nor trying to start some kind of fight. I'm just comparing the systems, maybe you know something I don't know or vice versa. Knowledge that could improve both these systems. I also see how "onClientRender" could create a perfect sync in theory but what if two different players has different FPS? It might be better than timers, but after all I don't really think that the sync can be done better than what the server are able to perform by the regular sync of server side objects. After all there's still latency and other network related delays to consider. While taking advantage of both server and client side, have you though of the idea using peds as engineers and use setControlState to control the trains? That and a list of points with a predefined "goal" speed might be the solution to allow the trains to stop at stations, or to drive at different speed in general or what do you think?
  19. Well you can't deny where you got the inspiration at least (GTWtrain) , although it looks pretty nice so far and I've been waiting for those functions as well, not just for a train system but they are actually useful for a lot of stuff like making switch points and stuff like that. After trying it I have some questions tho: I noticed that the client file is pretty big while the server file are smaller, are the train client sided? Did you disable the trains to stream out in order to keep them on the tracks or are you using something else? Does the trains spawn near players or are they always existing? It's nice with some competition in this area as MTA certainly need some kind of train system. That deals with all the issues you are mentioning. Although I got to object about the performance, running both the systems parallell while both systems managed 1 streamed in train each this was the results: Note that you're using between 25-30% CPU client side (intel core i7 950 @3GHz), while GTWtrain uses around 0.5% and 0% when there's no train nearby (server side (intel pentium @1.2GHz)). Are you using "onClientRender" to update the train speed?
  20. Mr_Moose

    Help

    toggleControl( player thePlayer, string control, bool enabled) Could be used to solve that, by disabling controls like fire, next/previous weapon and target you can stop the ability to attack other players. Here's a list of all available controls you can disable: https://wiki.multitheftauto.com/wiki/Control_names
  21. Latest version works: Download, although you also need GTWtrainhorn as it's used to provide the train horn feature required by the train system. A live demo can be found here. Free community support are also offered here if needed, good luck.
  22. Mr_Moose

    Help

    Thanks JR10, guess I didn't woke up yet. Updated my post as well.
  23. Mr_Moose

    Help

    That will only prevent team members from attacking each others, not from being attacked and damaged by other teams. To protect a team from others you can disable damage for it's members by cancelling the event. function protect_team(attacker, weapon, bodypart) if not getPlayerTeam(source) or getPlayerTeam(source) ~= getTeamFromName("TEAM_NAME") then return end cancelEvent() -- Cancel otherwise end addEventHandler("onClientPlayerDamage", localPlayer, protect_team) Updated
  24. Mr_Moose

    Remove Copies

    In theory it wouldn't be to hard to implement some kind of blacklisting system, the only problem is that it's relatively easy for servers to get around those as there's not much you can blacklist that can't be changed, things like the IP, server keys etc.. If all servers had a serial tho like the clients it could be easier or if all servers needed a player serial defined as owner. Then if a server does naughty stuff it's the owner that becomes globally banned for it by serial. Although it would still require a report system like the topic where community resources are reported and someone has to verify all accusations, but theoretically it could work. For now you have to rely on your own security implementations or compilation with a secret key that only allow the files to run on your server (identified by name probably) to protect your work. Luckily, those who steal others work usually have no idea about how to deal with eventual bugs, sometimes they even ask the original author for support.
  25. If it's even possible it requires a lot of effort as there's no standard functions to create custom railroads, you can however create your own system with nodes and force free train objects to follow the patterns, that's pretty much how the current system works but rewriting it all in Lua could would be pretty complicated tho. You'll also need to implement the standard functions for your system like the ability for trains to derail, attach cars, justify the speed based on keyboard input and output and stuff like that. If you intend to write an automatic train system which is completely controlled by bots it's probably easier to, then you just need to find a way to spawn a free train object which aren't bound to any track and then force it to move between certain custom nodes at a certain speed, guess you could create it as an object to accomplish that. I've heard a rumor long ago regarding custom train tracks to be built in to mtasa that says there's a branch or something where someone attempted to add support for something like this, it was seriously buggy tho but as it's all open source I think that would be easier to fix than building this from scratch hin Lua. I'm interested in that feature myself so I guess I could take a look at it when I get some time over. https://github.com/multitheftauto/mtasa-blue Update: Here it is: https://github.com/multitheftauto/mtasa-blue/tree/custom-train-tracks, well I guess it does exist a branch for custom train tracks then.
×
×
  • Create New...