Raised This Month: $ Target: $400
 0% 

Waiting for input without using set_task or a while/for loop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-05-2004 , 14:01   Waiting for input without using set_task or a while/for loop
Reply With Quote #1

Is there a way to "pause" the plugin while it waits for input?

I can't hook the input because the input happens in the middle of the plugin execution.


Code:
        new enter_tags         client_print(id,print_chat,"* [AMX MATCH] No Terrorist clantag found :/")                 enter_tags = get_cvar_num("amx_match_entertags")         if(enter_tags == 1)         {             copy (message_Tag, 191, "")                         client_cmd(id, "messagemode clanTag")                         // Need to pause here, to wait for input....             if(!equal(message_Tag, ""))             {                 enter_clantag(1)                                 client_print(id,print_chat,"* [AMX MATCH] %s has been added as the T clan tag", message_Tag)                }             else             {                 client_print(id,print_chat,"* [AMX MATCH] No T clan tag entered")             }                   }     }                     return PLUGIN_CONTINUE } public enter_clantag(team) //team = 1 - Ts, team = 2 - CTs {     if(team == 1)     {           client_print(0,print_chat,"DEBUG_CLANTAG | %d |", team)                         copy (clanT, 31, message_Tag)     }     else     {         copy (clanCT, 31, message_Tag)     }         return PLUGIN_CONTINUE } public messagemode_clantag(id,level,cid) {     read_args(message_Tag, 191)         remove_quotes(message_Tag)         client_print(id,print_chat,"DEBUG_MESSAGEMODE | %s |", message_Tag)         return PLUGIN_CONTINUE }

Code:
    // Enter clan tags     register_concmd("clanTag","messagemode_clantag",ADMIN_LEVEL_A,"< message >");


Thanks,
__________________
--Infra
Infra is offline
Send a message via AIM to Infra
EKS
Veteran Member
Join Date: Mar 2004
Location: Norway
Old 10-05-2004 , 14:06  
Reply With Quote #2

no you cant. You need to split it into 2 functions.
EKS is offline
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 10-05-2004 , 14:33  
Reply With Quote #3

If you would somehow "pause" the function and wait for user input it would pause the whole server and your clients would time out eventually.
Johnny got his gun is offline
Infra
Senior Member
Join Date: Aug 2004
Location: California
Old 10-05-2004 , 14:34  
Reply With Quote #4

ok so something like this?

Code:
    if (T_tagspos == 0)     {         new enter_tags         client_print(id,print_chat,"* [AMX MATCH] No Terrorist clantag found :/")                 enter_tags = get_cvar_num("amx_match_entertags")         if(enter_tags == 1)         {             copy (message_Tag, 191, "")                         client_cmd(id, "messagemode clanTag")             set_task(2.0, "clantag_Tloop")              }     }                     return PLUGIN_CONTINUE } public clantag_Tloop() {     if(strlen(message_Tag) != 0)     {         enter_clantag(1)                 client_print(id,print_chat,"* [AMX MATCH] %s has been added as the T clan tag", message_Tag)        }     else     {         set_task(2.0, "clantag_Tloop", 1340)     }   } public clantag_enter(team) //team = 1 - Ts, team = 2 - CTs {     if(team == 1)     {           client_print(0,print_chat,"DEBUG_CLANTAG | %d |", team)                         copy (clanT, 31, message_Tag)     }     else     {         copy (clanCT, 31, message_Tag)     }         return PLUGIN_CONTINUE } public clantag_messagemode(id,level,cid) {     read_args(message_Tag, 191)         remove_quotes(message_Tag)         client_print(id,print_chat,"DEBUG_MESSAGEMODE | %s |", message_Tag)         return PLUGIN_CONTINUE }

Code:
    // Enter clan tags     register_concmd("clanTag","messagemode_clantag",ADMIN_LEVEL_A,"< message >")
__________________
--Infra
Infra is offline
Send a message via AIM to Infra
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 17:11.


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