Raised This Month: $ Target: $400
 0% 

Problems with a selection detection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 06-15-2004 , 20:15   Problems with a selection detection
Reply With Quote #1

Code:
#include <amxmodx> public client_putinserver(id) {     new team[32]     get_user_team(id,team,31)     if(get_user_flags(id)&ADMIN_IMMUNITY)     {         return PLUGIN_CONTINUE     }     if(team[0]!='U')     {         client_cmd(id,"menuselect 10")         return PLUGIN_CONTINUE     }else{         client_cmd(id,"menuselect 5")         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE  } public check_time(id) {     new plist[32],pnum     get_players(plist, pnum ,"a")     for(new i=0; i<pnum; i++)     {         if(get_user_flags(plist[i]&ADMIN_IMMUNITY))         {             return PLUGIN_CONTINUE         }         if(is_user_alive(plist[i])!=1)         {             server_cmd("kick #%d ^"You failed to select a skin in time^"",plist[i])         }         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public plugin_init(){     register_plugin("Automatic Team Assign","0.2.2","[SMS]FlyingMongoose")     register_event("ShowMenu","client_putinserver","b","4&Team_Select")     register_event("VGUIMenu","client_putinserver","b","1=2","1=26","1=27")     register_logevent("check_time",2,"0=World triggered","1=Round_Start")     return PLUGIN_CONTINUE }
the problem is that it enters check_time, it just doesn't do anything
__________________
Please do NOT PM for support.

Only ask for support in plugin threads.

TunedChaos.com - Precision Tuned Game Servers
FlyingMongoose is offline
BAILOPAN
Join Date: Jan 2004
Old 06-15-2004 , 23:05  
Reply With Quote #2

1] How do you know it enters check_time?

2] for(new i=0; i<pnum; i++)
please do:
new i
for(i=0; i<pnum; i++)

3] Why are you binding these calls to client_putinserver, which is called separately also? my reveal trickiness...
__________________
egg
BAILOPAN is offline
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 06-16-2004 , 00:30  
Reply With Quote #3

I know it enters check_time because

Code:
for(new i=0; i<pnum; i++)     {         if(get_user_flags(plist[i]&ADMIN_IMMUNITY))         {             return PLUGIN_CONTINUE         }         if(is_user_alive(plist[i])!=1)         {             server_cmd("kick #%d ^"You failed to select a skin in time^"",plist[i])         }         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE

use to have

Code:
for(new i=0; i<pnum; i++)     {         console_print(i,"Num: %s",pnum)         if(get_user_flags(plist[i]&ADMIN_IMMUNITY))         {             return PLUGIN_CONTINUE         }         if(is_user_alive(plist[i])!=1)         {             server_cmd("kick #%d ^"You failed to select a skin in time^"",plist[i])         }         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE

and it did output something, htough it wasn't a number :-/
__________________
Please do NOT PM for support.

Only ask for support in plugin threads.

TunedChaos.com - Precision Tuned Game Servers
FlyingMongoose is offline
BAILOPAN
Join Date: Jan 2004
Old 06-16-2004 , 02:21  
Reply With Quote #4

it wasn't a number because you did "%s" instead of "%d"
__________________
egg
BAILOPAN is offline
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 06-16-2004 , 03:01  
Reply With Quote #5

okay that explains that...but...why won't this work? I'm so confused

to me this code should work
__________________
Please do NOT PM for support.

Only ask for support in plugin threads.

TunedChaos.com - Precision Tuned Game Servers
FlyingMongoose is offline
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 06-16-2004 , 05:37  
Reply With Quote #6

alright, now that I realized my error, I think I may be able to fix this
I was trying to detect alive players, when I wanted to detect dead players >.< thank you bail for helping me to realize that

Code:
#include <amxmod> public client_putinserver(id) {     new team[32]     get_user_team(id,team,31)     if(get_user_flags(id)&ADMIN_IMMUNITY)     {         return PLUGIN_CONTINUE     }     if(team[0]!='U')     {         client_cmd(id,"menuselect 10")         return PLUGIN_CONTINUE     }else{         client_cmd(id,"menuselect 5")         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE  } public check_time(id) {     new plist[32],pnum     get_players(plist,pnum,"b")     for(new i=0; i<pnum; i++)     {         if(is_user_alive(get_user_userid(plist[i]))!=1)         {             if(get_user_flags(plist[i])&ADMIN_IMMUNITY)             {                 return PLUGIN_CONTINUE             }else{                 server_cmd("kick #%d ^"You failed to select a skin in time^"",plist[i])             }         }                 return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public plugin_init(){     register_plugin("Automatic Team Assign","0.2.2","[SMS]FlyingMongoose")     register_event("ShowMenu","client_putinserver","b","4&Team_Select")     register_event("VGUIMenu","client_putinserver","b","1=2","1=26","1=27")     register_logevent("check_time",2,"0=World triggered","1=Round_Start")     return PLUGIN_CONTINUE }

this all works the way I intended it to. BAIL...you remind my of my programming teacher...you give a LITTLE hint on how to fix a problem then make me go and do it myself...and I did, thank you ;)
__________________
Please do NOT PM for support.

Only ask for support in plugin threads.

TunedChaos.com - Precision Tuned Game Servers
FlyingMongoose is offline
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 06-16-2004 , 16:17  
Reply With Quote #7

alright, after multiple people telling me doing everything I did in client_putinserver was a bad idea I decided I'd break hte plugin up a bit

Code:
#include <amxmodx> public client_putinserver(id) {     set_task(1.0,"assign_teams")     return PLUGIN_CONTINUE  } public assign_teams(id){     new plist[32],pnum,team[32]     new i     get_players(plist,pnum)         for(i=0; i<pnum; i++)     {         get_user_team(plist[i],team,31)         if(team[0]=='U')         {             if(get_user_flags(plist[i])&ADMIN_IMMUNITY)             {                 return PLUGIN_CONTINUE             }             server_print("Team: %s",team)             client_cmd(get_user_userid(plist[i]),"menuselect 5")             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE } public block_teams(id){     new team[32]     get_user_team(id,team,31)     if(get_user_flags(id)&ADMIN_IMMUNITY)     {         return PLUGIN_CONTINUE     }     if(team[0]!='U')     {         client_cmd(id,"menuselect 10")         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public check_time(id) {     new plist[32],pnum     get_players(plist,pnum,"b")     for(new i=0; i<pnum; i++)     {         if(is_user_alive(get_user_userid(plist[i]))!=1)         {             if(get_user_flags(plist[i])&ADMIN_IMMUNITY)             {                 return PLUGIN_CONTINUE             }else{                 server_cmd("kick #%d ^"You failed to select a skin in time^"",plist[i])             }         }                 return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public plugin_init(){     register_plugin("Automatic Team Assign","0.2.2","[SMS]FlyingMongoose")     register_event("ShowMenu","block_teams","b","4&Team_Select")     register_event("VGUIMenu","block_teams","b","1=2","1=26","1=27")     register_logevent("check_time",2,"0=World triggered","1=Round_Start")     return PLUGIN_CONTINUE }

Please tell me if that looks better someone
__________________
Please do NOT PM for support.

Only ask for support in plugin threads.

TunedChaos.com - Precision Tuned Game Servers
FlyingMongoose is offline
[FBX]
Senior Member
Join Date: May 2004
Old 06-17-2004 , 01:14  
Reply With Quote #8

the code looks fine but the concept looks flawed, from what I can tell, you kick a guy if the round starts and he hasn't picked a skin... but what if he joins right when it says "terrorists win!" or something... then he has less than half a second to pick or gets kicked. On one hand, you could kick him if he still hasn't picked for a whole consecutive round, and that wouldnt be hard to implement using your current code.
[FBX] is offline
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 06-17-2004 , 05:20  
Reply With Quote #9

it actually gives him until the round starts, the world triggered Round_Start doesn't occur until freeze time is up.
__________________
Please do NOT PM for support.

Only ask for support in plugin threads.

TunedChaos.com - Precision Tuned Game Servers
FlyingMongoose is offline
FlyingMongoose
Veteran Member
Join Date: Mar 2004
Old 10-04-2005 , 13:02  
Reply With Quote #10

Dusting off some old code and seeing if I can get this working again

But I need a server willing to test

Code:
 #include <amxmodx> public client_putinserver(id) {     set_task(1.0,"assign_teams")     return PLUGIN_CONTINUE } public assign_teams(id){     new plist[32],pnum,team[32]     new i     get_players(plist,pnum)         for(i=0; i<pnum; i++)     {         get_user_team(plist[i],team,31)         if(team[0]=='U')         {             if(get_user_flags(plist[i])&ADMIN_IMMUNITY)             {                 return PLUGIN_CONTINUE             }             server_print("Team: %s",team)             client_cmd(get_user_userid(plist[i]),"menuselect 5")             return PLUGIN_CONTINUE         }     }     return PLUGIN_CONTINUE } public block_teams(id){     new team[32]     get_user_team(id,team,31)     if(get_user_flags(id)&ADMIN_IMMUNITY)     {         return PLUGIN_CONTINUE     }     if(team[0]!='U')     {         client_cmd(id,"menuselect 10")         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public check_time(id) {     new plist[32],pnum     get_players(plist,pnum,"b")     new i     for(i=0; i<pnum; i++)     {         if(is_user_alive(get_user_userid(plist[i]))!=1)         {             if(get_user_flags(plist[i])&ADMIN_IMMUNITY)             {                 return PLUGIN_CONTINUE             }else{                 server_cmd("kick #%d ^"You failed to select a skin in time^"",plist[i])             }         }         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public plugin_init(){     register_plugin("Automatic Team Assign","0.2.2","FlyingMongoose")     register_event("ShowMenu","block_teams","b","4&Team_Select")     register_event("VGUIMenu","block_teams","b","1=2","1=26","1=27")     register_logevent("check_time",2,"0=World triggered","1=Round_Start")     return PLUGIN_CONTINUE }

I've made a TINY change (I fixed format of one of my loops) lol. Anyone have any more suggestions?

I'm also thinking of basing this around the round time instead of round start, how can I recieve that variable to give that player that much time to select a skin?

Yay for necro-posting
FlyingMongoose is offline
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 14:40.


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