Raised This Month: $ Target: $400
 0% 

Extend Caller


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-05-2005 , 22:24  
Reply With Quote #1

ok well i think this is the final version and ive put ur name in the makers thingo as well, cuz u know u helped alot


so i was just wondering if you could run over this and check its all correct before i try it out on a server with real players


Code:
/*The Idea behind this plugin... The commands for this plugin... */ #include <amxmodx> // Stores the amount of votes new votes; //stores maptime new maptime // Tells whether or not timeleft thing has already been done new bool:switchy; public plugin_init()     {     register_plugin("NS Combat Extender","1.0","semaja2 and Hawk552");         // Catches when someone says anything     register_clcmd("say","Hook_Say");         // cvars     register_cvar("amx_extend","1");     register_cvar("amx_extend_votes","5");     register_cvar("amx_extend_time", "5.0");         // sets task for checking timeleft     set_task(get_cvar_float ( const amx_extend_time[] ),"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;                 //cmds to extend         new maptime  =  get_cvar_num ( "mp_timeleft" )         set_cvar_num ( "mp_timeleft" , maptime+10 )             }     else     {         // if that stuff above doesn't happen, then check again in 5 seconds         set_task(get_cvar_float ( const amx_extend_time[] ),"check_tl");     }         return 0; }
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-05-2005 , 22:27  
Reply With Quote #2

Don't use const amx_extend_time[], instead, use "amx_extend_time", like this:

EDIT: Also, it's mp_timelimit, not mp_timeleft.

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 and Hawk552");         // Catches when someone says anything     register_clcmd("say","Hook_Say");         // cvars     register_cvar("amx_extend","1");     register_cvar("amx_extend_votes","5");     register_cvar("amx_extend_time", "5.0");         // sets task for checking timeleft     set_task(get_cvar_float ( "amx_extend_time" ),"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;                 //cmds to extend         new maptime  =  get_cvar_num ( "mp_timelimit" )         set_cvar_num ( "mp_timelimit" , maptime+10 )             }     else     {         // if that stuff above doesn't happen, then check again in 5 seconds         set_task(get_cvar_float ( "amx_extend_time" ),"check_tl");     }         return 0; }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-05-2005 , 23:00  
Reply With Quote #3

ok im testing it now on the server and it seems everything that is said is a vote cuz it keeps saying u have cast ur vote after we say something
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-05-2005 , 23:08  
Reply With Quote #4

What? Try changing the containi statement to something other than extend, I guess.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-05-2005 , 23:11  
Reply With Quote #5

yeh but if im right it should only cast a vote if extend is said but even if extend isnt said it votes, could it be something to do with the if statment

Quote:
Originally Posted by Hawk552
What? Try changing the containi statement to something other than extend, I guess.
semaja2 is offline
Send a message via MSN to semaja2
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-05-2005 , 23:26  
Reply With Quote #6

also isnt it only ment to check for exetend in the last 5 mins of the timeleft
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-05-2005 , 23:27  
Reply With Quote #7

Yes, but what it does is keep checking every 5 seconds. If the timeleft is under 5 minutes, THEN it checks the votes, and if it's 5, extends it.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-05-2005 , 23:39  
Reply With Quote #8

ahh i see so u can vote at any point in time, how hard would it be to fix that error :S and make it so it only lets u vote in the last 5 mins?
semaja2 is offline
Send a message via MSN to semaja2
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-05-2005 , 23:56  
Reply With Quote #9

Try this:

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 and Hawk552");         // Catches when someone says anything     register_clcmd("say","Hook_Say");         // cvars     register_cvar("amx_extend","1");     register_cvar("amx_extend_votes","5");     register_cvar("amx_extend_checktime", "5");     register_cvar("amx_extend_time","5");         // sets task for checking timeleft     set_task(get_cvar_float ( "amx_extend_time" ),"check_tl"); } public Hook_Say(id) {     // if extend off, stop     if(!get_cvar_num("amx_extend") || get_timeleft() > get_cvar_num("amx_extend_time"))         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;                 //cmds to extend         new maptime  =  get_cvar_num ( "mp_timeleft" )         set_cvar_num ( "mp_timeleft" , maptime+10 )             }     else     {         // if that stuff above doesn't happen, then check again in 5 seconds         set_task(get_cvar_float ( "amx_extend_checktime" ),"check_tl");     }         return 0; }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
semaja2
Member
Join Date: Aug 2005
Location: Adelaide
Old 11-06-2005 , 00:22  
Reply With Quote #10

hey i think i found something this could just be correct or a typo by u but should there be a ; after the votes++



Code:
    // if it contains "extend", increase votes       if(containi(arg,"extend") != -1)           votes++;             client_print(id,print_chat,"You have voted to extend the map.");
semaja2 is offline
Send a message via MSN to semaja2
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 23:37.


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