[email protected] Posted January 9, 2008 Share Posted January 9, 2008 Update: I am still looking for a way to set a timer, when a vehicle is spawned. This does not mean respawned. For the script to function 100% as it was intended to function I will probably need a hint from someone on how to trigger an event when a vehicle is spawned, even if it was spawned from external scripts/resources. Hints are extremely welcome on this Link to comment
Rynet Posted January 10, 2008 Author Share Posted January 10, 2008 Nice work, I will put it into testing and post any feedback here. Link to comment
Cloudhunter Posted January 10, 2008 Share Posted January 10, 2008 Well, I've looked through the scripting wiki and I can't see any event that would be called when createVehicle is called. To the Devs: Is there a way of detecting the createVehicle call? Or would an event have to be added by you guys? Cloudy Edit: Just as I posted this (typical) I thought of a (hacky) way to detect new vehicles. Basically, do 'vehicles = getElementsByType ( "vehicle" )', and have it on a timer - then check (I don't know how to do this, but know it's possible) whether a new vehicle has been added to the table, and add it to the queue. Link to comment
[email protected] Posted January 10, 2008 Share Posted January 10, 2008 Nice work, I will put it into testing and post any feedback here. Sorry Rynet, the last available version is a bit outdated again, I will be removing most debug output from the script now, and upload the latest one after that. I will update when it is up with the link in this post, once it is online. UPDATE: newest version uploaded to: http://www.colips.nl/files/vrdelay0.2b2.zip Newest version also has a help-tab on the help-manager resource now, describing what it does and the known issues we've discovered while testing it locally, debug output is suppressed in this version. One major change in this version is the structure of the destruction queue. Instead of holding vehicles in it, it holds arrays of vehicles, combined with timers. That way the timer is guaranteed to be bound to the vehicle on the queue, and can easily be destroyed with it's vehicle. The structure now looks like: { { vehicle1, timer1 }, { vehicle2, timer2 }, { vehicle3, timer3 }, etc.. } Plan for next version is to make it more configurable, hopefully with an included GUI --- Clouds response (edit) has some sense, that would be my alternative if it isn't possible to put a vehicle on the queue directly when it spawned. Most likely this can can be done with something like: if not (isVehicleOnDestructionQueue( vehicleObj )) and isEmptyVehicle( vehicleObj ), then add it to the queue, for every vehicle on the server. The functions in that are to be found inside the lua scriptfile, and do exactly as the implementation description says Link to comment
Cloudhunter Posted January 10, 2008 Share Posted January 10, 2008 Clouds response (edit) has some sense, that would be my alternative if it isn't possible to put a vehicle on the queue directly when it spawned.Most likely this can can be done with something like: if not (isVehicleOnDestructionQueue( vehicleObj )) and isEmptyVehicle( vehicleObj ), then add it to the queue, for every vehicle on the server. The functions in that are to be found inside the lua scriptfile, and do exactly as the implementation description says Yeah, that seems sensible - Less complex, but better - you could add data to the element of each vehicle on a timer, and see if already has the element set to true. Using the Element system, you could also have some vehicles immune - for instance, vehicles spawned by an admin. Cloudy Link to comment
Martz Posted January 10, 2008 Share Posted January 10, 2008 Will it be possible to remove all the vehicles someone has spawned if they get kicked? Say for instance a spammer were to spawn a load of tanks and when they get vote or admin kicked for doing so, all the tanks will dissapear. I think this will be quite useful so if you manage to figure out how to set the timer on any spawned vehicle then could you try and do something along the lines of this? Maybe going too deep, but it'd be awesome if someone manually quits or times out then their vehicles get put on the timer instead and taken off if they rejoin, but this looks like a hell load of work. Link to comment
ChrML Posted January 10, 2008 Share Posted January 10, 2008 Will it be possible to remove all the vehicles someone has spawned if they get kicked?Say for instance a spammer were to spawn a load of tanks and when they get vote or admin kicked for doing so, all the tanks will dissapear. I think this will be quite useful so if you manage to figure out how to set the timer on any spawned vehicle then could you try and do something along the lines of this? Maybe going too deep, but it'd be awesome if someone manually quits or times out then their vehicles get put on the timer instead and taken off if they rejoin, but this looks like a hell load of work. The easiest way is putting the player that created a vehicle in the vehicle element using setElementData. ie setElementData ( createdVehicle, "creator", playerThatCreatedIt ). When a player exits, just loop through all the cars looking for a matching "creator" and delete it if the car is empty. If it's not empty, perhaps change the creator to the current driver of the car. There is no way to detect an element being created yet. We might have to add something like onElementCreate for a future release. Link to comment
[email protected] Posted January 10, 2008 Share Posted January 10, 2008 Will it be possible to remove all the vehicles someone has spawned if they get kicked?Say for instance a spammer were to spawn a load of tanks and when they get vote or admin kicked for doing so, all the tanks will dissapear. I think this will be quite useful so if you manage to figure out how to set the timer on any spawned vehicle then could you try and do something along the lines of this? Maybe going too deep, but it'd be awesome if someone manually quits or times out then their vehicles get put on the timer instead and taken off if they rejoin, but this looks like a hell load of work. The easiest way is putting the player that created a vehicle in the vehicle element using setElementData. ie setElementData ( createdVehicle, "creator", playerThatCreatedIt ). When a player exits, just loop through all the cars looking for a matching "creator" and delete it if the car is empty. If it's not empty, perhaps change the creator to the current driver of the car. There is no way to detect an element being created yet. We might have to add something like onElementCreate for a future release. Thanks for confirming that it is currently not yet possible to detect whether a new element is created or not, ChrML. That implies I have to find an alternative way to get done what I wish to reach Link to comment
Rynet Posted January 12, 2008 Author Share Posted January 12, 2008 Hopefully that functionality will be added in a future developer release and make things much easier to do with this script. Link to comment
[email protected] Posted January 12, 2008 Share Posted January 12, 2008 Hopefully that functionality will be added in a future developer release and make things much easier to do with this script. I have also been thinking about cars not being "visually" removed sometimes... I had a similar issue with 3d objects. For those 3d objects I found a way to remove them visually, client-side after they got destroyed. Perhaps that also works for the vehicles, will try this for the next version. Link to comment
[email protected] Posted January 12, 2008 Share Posted January 12, 2008 I am not sure what went wrong, but it looks like vrdelay0.2 is crashing the server. The issue occurs for me on windows as well as linux, when I tried to load it on developement release 2 of the MTA server program. I will update this post when I figured out a bit more about this. EDIT: Found out that both my windows server and linux server crash, as soon as I try to use set("name", variable), I cannot set data in the settings register of the MTA server anymore, without having it crash. Using get("name") however does still work, or at least it does not make the server crash currently. I will report this as a bug also if no one has done that yet. Until then, please do not use vrdelay, until the issue is solved. Link to comment
FIRESTARTER Posted February 5, 2008 Share Posted February 5, 2008 This crashes my server totaly when i start it as a resource at the admin panel lol lame Link to comment
idiot Posted February 5, 2008 Share Posted February 5, 2008 This crashes my server totaly when i start it as a resource at the admin panel lollame I have the same problem ... it sucks to restart the server if too many vehicles were spawned (only a freeroam / stunt map runs on my server). The script would be helpful but it crashes all Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now