Random Map on Server Startup
1 Attachment(s)
Well, I couldn't find one myself, and can't believe there isn't one (I think). So I decided to make one.
Changelog: * v1.0.0 - Initial Release * v1.1.0 - Optimised code greatly, and actually fixed it not changing :P * v1.1.1 - Fixed again - this time, it WILL work xD * v1.1.2 - Removed some useless crap... * v1.2.0 - Implemented some of the changes that Hawk552 suggested (now you can't say I don't listen) * v1.2.1 - Optimisation suggested by Hawk552 * v1.2.5 - Added a way to turn the script off with sv_randommap <0/1> (0 for off, 1 for on) Cvars: sv_randommap <1/0> - Set to 0 to disable the random map or set to 1 to enable it as normal. To install: 1: Compile 2: Reference in plugins.ini 3: Start the server up (it will load your startup map then calculate a random map from maps.ini or mapcycle.txt and then change the map) Suggestions? Problems? Let me know (IN HERE PLEASE). For v1.2.5+ please make sure you have written the cvar sv_randommap in server.cfg or this may not work. |
Re: Random Map on Server Startup
Problems:
Bad description No file Gaben? |
Re: Random Map on Server Startup
Bad description? Have you even read the title? I think that explains it all.
No file? Are you blind? |
Re: Random Map on Server Startup
1. You need to add a description and explain and get into more detail.
2. You uploaded the file when I was typing that. |
Re: Random Map on Server Startup
1: No, I don't need to go into detail about a small plugin, it's self explanatory. Or shall I just post every function used just for a description?
2: Actually I deleted the file, and reuploaded it because I found a typo. |
Re: Random Map on Server Startup
Okay guys, I just realised that the code was messed up so I have fixed it and optimised it.
|
Re: Random Map on Server Startup
1 Attachment(s)
I've tried too. I think it's a little more efficient & optimize. Feel free to use or not.
Cvars :
|
Re: Random Map on Server Startup
cool thx!
|
Re: Random Map on Server Startup
DataMatrix obviously won't be able to maintain this. Unapproved.
|
Re: Random Map on Server Startup
Quote:
|
Re: Random Map on Server Startup
Every plugin can break or have a bug. Just because it's simple doesn't guarantee anything.
|
Re: Random Map on Server Startup
v1.12 released
|
Re: Random Map on Server Startup
Hehe, its a cool idea, give him a shot. Unapprove it later if he shows that he can't handel it. But if he can, hell give him a shot, You don't know if you don't give him a try ;)
|
Re: Random Map on Server Startup
Quote:
Code:
What's this? Why not just use pcvars? Code:
Uhh... why not just combine the RandomMap() function call into the if statement, which also justifies putting brackets in it? Also, why did you return PLUGIN_HANDLED? Why did you even return PLUGIN_CONTINUE? If you HAD to do this, the fastest way (typing-wise) would probably be to just use "return". Code:
Okay, you got me here. Why is it public? Is it called anywhere outside of the plugin? Is it a forward? No? Drop the "public" keyword. Code:
I not only don't get why you don't just do this: Code:
But I don't get why you missed a simple thing like the risk of a buffer overflow. You don't declare an array as 256 then use 256 as the max length, it's 255 to allow for the null terminator. Code:
Why return PLUGIN_HANDLED? There's no point, the return value doesn't do anything. On top of that, you should use log_amx for people who don't have direct access to the console. It might also be a good idea to use copy instead of format, since there are no variables. Code:
Nothing really too wrong here, but if I were to do it, I would have declared the variables like this to save space: Code:
It's also probably better to use the "random" function, since you don't have to push an additional parameter onto the stack. The usage would be something like "random(size)" Code:
This may confuse server owners who think they should set this. Not really any way around it that I can think of, but also you should either use log_amx or just remove the server_print section entirely. Code:
Useless, if you avoided the return that I mentioned earlier, you wouldn't need this. In conclusion, this is staying here. |
Re: Random Map on Server Startup
Uhh, if I remove
Code:
You must end the current function with return if you don't want any other code to be executed. But meh, I like PHP better, I always thought of return PLUGIN_HANDLED as the equivalent to die(); Besides, do you see any other map randomisers? Well I don't, so if you can do better, please do, and who cares about an overflow, as soon as the map changes the damn plugin disables itself. |
Re: Random Map on Server Startup
Quote:
You don't need the return statement because it can be rewritten: Code:
-> Code:
If you don't want to fix the overflow, that's fine with me. This won't stand a prayer in hell of being approved, though. |
Re: Random Map on Server Startup
v1.2.0 released.
|
Re: Random Map on Server Startup
Also, I didn't notice at first but you can do:
Code:
Instead of your crazy stuff. |
Re: Random Map on Server Startup
Quote:
v1.2.1 released. |
Re: Random Map on Server Startup
v1.2.5 released.
PS: Hawk552, what is the difference with pcvars and cvars? |
Re: Random Map on Server Startup
|
Re: Random Map on Server Startup
mhh didnt work, plugin runs and cvar sv_randommap 1 is set in server.cfg.
|
Re: Random Map on Server Startup
This plugin is in need of a new developer.
Current version doesn't work. |
Re: Random Map on Server Startup
Quote:
|
Re: Random Map on Server Startup
|
Re: Random Map on Server Startup
Quote:
|
| All times are GMT -4. The time now is 08:36. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.