Raised This Month: $ Target: $400
 0% 

My Map Changing Plugin for TS.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
terrum
AlliedModders Donor
Join Date: Apr 2006
Location: United Kingdom
Old 05-30-2007 , 19:14   My Map Changing Plugin for TS.
Reply With Quote #1

this is my script i made myself. Yes it's probably stupidly wrong but it's my first plugin. I want it so it doesn't repeat the cycle more than 1 time, i only want it to do this once, how do i do this? thanks

Quote:
#include <amxmodx>
#include <engine>

//terrum_meckmapchange.sma:
// Custom plugin by Terrum. Not to be released.

new const PLUGIN[] = "Mecklenburg Map Changer"
new const VERSION[] = "1"
new const AUTHOR[] = "Terrum"
new cycler_classname[] = "whatever"

new const Float:cycler_time = 5.0 //cycler runs every so many seconds
new const cvar_name[] = "amx_mecklenburg_mapchange"
new const cvar_default[] = "1" //default cvar value. "1"=on,"0"=off

public plugin_init() {
register_plugin(PLUGIN,VERSION,AUTHOR)
register_cvar( cvar_name , cvar_default )
new entity = create_entity("info_target")
entity_set_string(entity,EV_SZ_classname,cycl er_classname)
entity_set_float(entity,EV_FL_nextthink,halfl ife_time() + cycler_time)
register_think(cycler_classname,"HandleCycler ")
} //public.plugin_init

public HandleCycler(entity) {
if ( get_cvar_num( cvar_name ) > 0 ) { //if cvar greater than zero
} //if.cvar
server_cmd("amx_map mecklenburgv5_a6")
server_cmd("amxx pause terrum_meck")
} //public.HandleCycler
EDIT: Well all i want it to do is change the map to "mecklenburgv5_a6" once after 5 seconds the server starts and have a CVAR "amx_mecklenburg_mapchange" default to 1 (1 = on. 0 = off.)
__________________
Thanks,
Terrum.



Last edited by terrum; 05-30-2007 at 19:41.
terrum is offline
Send a message via AIM to terrum Send a message via MSN to terrum Send a message via Skype™ to terrum
stupok
Veteran Member
Join Date: Feb 2006
Old 05-30-2007 , 20:49   Re: My Map Changing Plugin for TS.
Reply With Quote #2

Is this what you're looking for?
Code:
#include <amxmodx> #define PLUGIN "Map Change" #define VERSION "1.0" #define AUTHOR "stupok69" new cvar_meck public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         cvar_meck = register_cvar("amx_mecklenburg_mapchange", "1")         set_task(5.0, "delay_mapchange") } public delay_mapchange() {     if(get_pcvar_num(cvar_meck))     {         server_cmd("changelevel mecklenburgv5_a6")     } }
stupok is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-30-2007 , 21:11   Re: My Map Changing Plugin for TS.
Reply With Quote #3

I used this in one of my plugins that ends the map if you use amx_extend -x where x is greater than the time remaining. I believe I may have originally taken some code from the original amx_map command.

Code:
if (invtlimit * 60 >= get_timeleft()) {     client_print(id,print_console, "%s You have ended the map.", TAG)     client_print(0,print_chat, "%s %s has ended the map.", TAG, name)         //server_cmd("amx_map %s", get_cvar_string("amx_nextmap"))                  //make a note of this message to display the     //scoreboard as if the map was ending normally     message_begin(MSG_ALL, SVC_INTERMISSION)     message_end()     set_task(2.0, "change_map")         return PLUGIN_HANDLED } public change_map() {     new nextmap[32]     get_cvar_string("amx_nextmap", nextmap, 31)     server_cmd("changelevel %s", nextmap) }

Last edited by Lee; 05-30-2007 at 21:13.
Lee is offline
terrum
AlliedModders Donor
Join Date: Apr 2006
Location: United Kingdom
Old 05-30-2007 , 21:18   Re: My Map Changing Plugin for TS.
Reply With Quote #4

Quote:
Is this what you're looking for?
Code:

#include <amxmodx> #define PLUGIN "Map Change" #define VERSION "1.0" #define AUTHOR "stupok69" new cvar_meck public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) cvar_meck = register_cvar("amx_mecklenburg_mapchange", "1") set_task(5.0, "delay_mapchange") } public delay_mapchange() { if(get_pcvar_num(cvar_meck)) { server_cmd("changelevel mecklenburgv5_a6") } }
That does the same thing as what my plugin does.

It changes the map every 5 seconds, i only want it to change the map ONCE after 5 seconds the server is up (Edit the plugin so it doesn't repeat itself, if possible. If not possible, then forget about it.)

Quote:
Originally Posted by Lee View Post
I used this in one of my plugins that ends the map if you use amx_extend -x where x is greater than the time remaining. I believe I may have originally taken some code from the original amx_map command.

Code:
if (invtlimit * 60 >= get_timeleft()) {     client_print(id,print_console, "%s You have ended the map.", TAG)     client_print(0,print_chat, "%s %s has ended the map.", TAG, name)         //server_cmd("amx_map %s", get_cvar_string("amx_nextmap"))                  //make a note of this message to display the     //scoreboard as if the map was ending normally     message_begin(MSG_ALL, SVC_INTERMISSION)     message_end()     set_task(2.0, "change_map")         return PLUGIN_HANDLED } public change_map() {     new nextmap[32]     get_cvar_string("amx_nextmap", nextmap, 31)     server_cmd("changelevel %s", nextmap) }
That's not exactly what i need, Thanks anyway though.
__________________
Thanks,
Terrum.



Last edited by terrum; 05-30-2007 at 21:35. Reason: The posts went bad and lagged out lol!
terrum is offline
Send a message via AIM to terrum Send a message via MSN to terrum Send a message via Skype™ to terrum
stupok
Veteran Member
Join Date: Feb 2006
Old 05-30-2007 , 22:03   Re: My Map Changing Plugin for TS.
Reply With Quote #5

Well I think this is the easiest way to do that. You could, instead, write a value to a file and check if the function has been executed. If you're just trying to start a server with a specific map, check out the .bat below.

Code:
#include <amxmodx> #define PLUGIN "Map Change" #define VERSION "1.0" #define AUTHOR "stupok69" new cvar_meck public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         cvar_meck = register_cvar("amx_mecklenburg_mapchange", "1")         set_task(5.0, "delay_mapchange") } public delay_mapchange() {     if(get_pcvar_num(cvar_meck))     {         set_pcvar_num(cvar_meck, 0)         server_cmd("changelevel mecklenburgv5_a6")     } }

I use a .bat to start my server, it looks like this:
Code:
start /high hlds.exe -console -game ts -port 27017 -maxplayers 10 +map mecklenburg_b5
stupok is offline
terrum
AlliedModders Donor
Join Date: Apr 2006
Location: United Kingdom
Old 05-30-2007 , 22:27   Re: My Map Changing Plugin for TS.
Reply With Quote #6

I use a script in .bat as well to restart my server. But that's not the point.. It's a amxx plugin whats causing the map not to change to mecklenburgv5_a6 so that's why i want this plugin..
anyway.. this plugin works.. thanks +karma
__________________
Thanks,
Terrum.


terrum is offline
Send a message via AIM to terrum Send a message via MSN to terrum Send a message via Skype™ to terrum
Reply



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 10:38.


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