Raised This Month: $14 Target: $400
 3% 

AMX Random Map - Version 1.1 [8/31/09]


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Admin Commands       
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-31-2009 , 10:23   AMX Random Map - Version 1.1 [8/31/09]
Reply With Quote #1

AMX Random Map v1.1
BOYSplayCS

Description:

Admins can now use a single command to randomly change the map. It works by the plugin reading all the lines from the file 'mapcycle.txt' and then randomly choosing one.


Admin Commands:

  • amx_random_map (Required: ADMIN_MAP)
    • Important Note: Make sure there are maps listed inside your mapcycle.txt or nothing will happen.

Requirements:

  • AMX Mod X (version 1.8.1 or higher)

Credits:

  • Exolent - Major Coding Help
  • Arkshine - Coding Help

Changelog:
  • Version 1.0
    • Initial Release.
  • Version 1.1
    • Added FCVAR_SERVER and FCVAR_SPONLY for tracking.
    • Removed having to type '1' after amx_random_map.
    • Added fclose() to close the reading of the file.
    • Optimized code.

Installation Help:

* Place amx_random_map.amxx in your \account-name\counter-strike\cstrike\addons\amxmodx\plugins folder.

* Add amx_random_map.amxx to your plugins.ini file.
Attached Files
File Type: sma Get Plugin or Get Source (amx_random_map.sma - 946 views - 2.0 KB)

Last edited by BOYSplayCS; 08-31-2009 at 11:48. Reason: New version: 1.1
BOYSplayCS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-31-2009 , 10:32   Re: AMX Random Map - Version 1.0 [8/31/09]
Reply With Quote #2

Why 1 ? Is not amx_random_map enough ?!

Also, you forget to close the file after usage.
__________________
Arkshine is offline
zacky
Senior Member
Join Date: Mar 2008
Location: Sweden
Old 08-31-2009 , 10:57   Re: AMX Random Map - Version 1.0 [8/31/09]
Reply With Quote #3

And what if you use maps.ini? o.0
zacky is offline
Send a message via Skype™ to zacky
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-31-2009 , 11:17   Re: AMX Random Map - Version 1.0 [8/31/09]
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
Why 1 ? Is not amx_random_map enough ?!

Also, you forget to close the file after usage.
Because, if you just use amx_random_map then you'll get a "Access Denied" error, the 1 is a must.

I'll close the file in the next version.

Quote:
Originally Posted by zacky View Post
And what if you use maps.ini? o.0
I'll add a maps.ini seperate plugin once I release v1.1
BOYSplayCS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-31-2009 , 11:19   Re: AMX Random Map - Version 1.0 [8/31/09]
Reply With Quote #5

Then in cmd_access(), change 2 by 1... Are you sure it's you who have written the plugin ?

Quote:
I'll add a maps.ini seperate plugin once I release v1.1
Just make a cvar so people can provide the file used.
__________________
Arkshine is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-31-2009 , 11:22   Re: AMX Random Map - Version 1.0 [8/31/09]
Reply With Quote #6

Quote:
Originally Posted by Arkshine View Post
Then in cmd_access(), change 2 by 1... Are you sure it's you who have written the plugin ?



Just make a cvar so people can provide the file used.
Oh, really? I never looked up how to use cmd_access(), so don't blame me haha. Also, I wrote the original, non-working plugin and Exolent wrote the working version.
BOYSplayCS is offline
BOYSplayCS
BANNED
Join Date: Apr 2008
Location: Gainesville, FL
Old 08-31-2009 , 11:49   Re: AMX Random Map - Version 1.1 [8/31/09]
Reply With Quote #7

Update: Uploaded new version (1.1) and fixed a few bugs. See changelog.

To-Do:
Add cvar to switch between mapcycle.txt and maps.ini
BOYSplayCS is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-31-2009 , 12:07   Re: AMX Random Map - Version 1.1 [8/31/09]
Reply With Quote #8

File is not close in if (!iFile) {} and if (!iTotal) {}

and the client_print saying "[AMXX] Access Denied blabla" is pointless since you have already such message when you use cmd_access().

Quote:
Add cvar to switch between mapcycle.txt and maps.ini
Just to note that it may another file than these ones. It should be a cvar to specify a map cycle file name, not a switch between 2 files.
__________________

Last edited by Arkshine; 08-31-2009 at 12:11.
Arkshine is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-31-2009 , 23:01   Re: AMX Random Map - Version 1.1 [8/31/09]
Reply With Quote #9

Also you can add a cvar that when the first map end, the next map is RANDOM... obviusly you have to advertise ppl to pause plugins like mapchooser, galileo, etc..

And yes, like Arkshine said... in cmd_acces the number "2" means the COMMAND and the VALUE, so if you use number "1" you are only using the COMMAND.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-01-2009 , 05:27   Re: AMX Random Map - Version 1.1 [8/31/09]
Reply With Quote #10

register_cvar("amx_random_map", "1.1", FCVAR_SERVER | FCVAR_SPONLY);

->

register_cvar("amx_random_map", VERSION, FCVAR_SERVER | FCVAR_SPONLY);

And remove
PHP Code:
else
        
client_print(idprint_chat"[AMXX] Access Denied || Correct Usage: amx_random_map"); 
cmd_access already prints denied msg..

EDIT: @Arkshine: you said close file in if (!iFile) {}, its even not opened.. iFile is 0.
__________________

Last edited by xPaw; 09-01-2009 at 05:30.
xPaw is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:58.


Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode