AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Extend Caller (https://forums.alliedmods.net/showthread.php?t=20300)

semaja2 11-05-2005 21:23

Extend Caller
 
Hey guys ive decided to make a new topic for my plugin since it didnt really belong in the old topic i made, so heres what ive made so far and i would like it if you guys could help me finish it

the idea is:
Quote:

in ns we have alot of trouble with combat matches ending when we dont so what the mod does is 5 mins before the end of a co_ map it will keep a eye out to see if the word extend has been said more then 5 times and if it has it will call for a vote and if it gets yes it increases the sv_combattime up by like 10 mins
Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <ns> #define PLUGIN "extend caller" #define VERSION "0.0.1" #define AUTHOR "semaja2" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_sayextend", "extend", ADMIN_SLAY, "Set to 1 to enable")                 /*  ns_is_combat ( )   -----removed for now------     if ns_is_combat==1     return PLUGIN_HANDLED*/ } public extend () {     new maptime  =  get_cvar_num ( const sv_combattime[] )                 set_cvar_num ( const sv_combattime[],maptime++10 )     return PLUGIN_HANDLED     }
[/small]

Hawk552 11-05-2005 21:32

Code:
#include <amxmodx> new votes,bool:switchy; public plugin_init() {     register_plugin("NS Combat Extender","1.0","semaja2");         register_clcmd("say","Hook_Say");         register_cvar("amx_extend","1");     register_cvar("amx_extend_votes","5");         set_task(5.0,"check_tl"); } public Hook_Say(id) {     if(!get_cvar_num("amx_extend"))         return 0;             new arg[128];     read_argv(1,arg,127);         if(containi(arg,"extend") != -1)         votes++;             client_print(id,print_chat,"You have voted to extend the map.");         return 0; } public check_tl() {     if(!get_cvar_num("amx_extend") || switchy)         return 0;             new timeleft = get_timeleft();         if(timeleft <= 300 && votes >= get_cvar_num("amx_extend_votes"))     {                 switchy = true;         // whatever vote stuff     }         return 0; }

something like that? I still don't get what sv_combattime is. Is it like mp_timeleft, except for co_ maps? Or something?

semaja2 11-05-2005 21:37

ummm... well i can kinda under stand whats going on but could u tell me like whats going on cuz im confused atm

PS my fault its mp_combattime not sv

Hawk552 11-05-2005 21:41

I noticed some error in my code, and also documented it

Code:
#include <amxmodx> // Stores the amount of votes new votes; // Tells whether or not timeleft thing has already been done new bool:switchy; public plugin_init() {     register_plugin("NS Combat Extender","1.0","semaja2");         // Catches when someone says anything     register_clcmd("say","Hook_Say");         // cvars     register_cvar("amx_extend","1");     register_cvar("amx_extend_votes","5");         // sets task for checking timeleft     set_task(5.0,"check_tl"); } public Hook_Say(id) {     // if extend off, stop     if(!get_cvar_num("amx_extend"))         return 0;             // reads what the person said     new arg[128];     read_argv(1,arg,127);         // if it contains "extend", increase votes     if(containi(arg,"extend") != -1)         votes++;             client_print(id,print_chat,"You have voted to extend the map.");         return 0; } public check_tl() {     if(!get_cvar_num("amx_extend") || switchy)         return 0;             // get timeleft     new timeleft = get_timeleft();         if(timeleft <= 300 && votes >= get_cvar_num("amx_extend_votes"))     {         // timeleft stuff said now         switchy = true;                 // place your voting stuff here         // whatever vote stuff     }     else     {         // if that stuff above doesn't happen, then check again in 5 seconds         set_task(5.0,"check_tl");     }         return 0; }

Hawk552 11-05-2005 21:45

If you want me to help you, I need to know what mp_combattime is. You still have not explained what it is / does.

semaja2 11-05-2005 21:47

ok this code looks great thanks heaps, now to spend a hour working it out :P, umm so now if i was to shove this into the vote are u left it should exetend by ten mins?

Code:
new maptime  =  get_cvar_num ( const mp_combattime[] ) set_cvar_num ( const sv_combattime[],maptime++10 )

ok mp_combattime is like the amount of time spend in a match, so like u have 40 mins to kill the oppents hive or cc and if it runs out then the aliens win, if u up the number of mp_combattime it extend the mathc i belive

semaja2 11-05-2005 21:52

wait i made a big mistake sorry i think it is mp_timeleft, becuase mp_combattime doesnt chnage until the round restarts

either way i can change it later when i find the correct command cuz all it needs to do is add 10

Hawk552 11-05-2005 22:10

I think you mean

Code:
new maptime  =  get_cvar_num ( "mp_combattime" ) set_cvar_num ( "mp_combattime" , maptime+10 )

And it's "mp_timelimit".

semaja2 11-05-2005 22:13

ok its all compiled now and stuff, now all i need to know is like whats the times for all of this, like how long does it wait till it starts checking and stuff

PS. now that i think about it i might add a cvar for the times, so if i know where they are ill put them in

Hawk552 11-05-2005 22:15

set_task(5.0,"check_tl"); <--- 5.0 is how long it waits. You can just add a get_cvar_float and register_cvar if you'd like.


All times are GMT -4. The time now is 23:37.

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