Raised This Month: $ Target: $400
 0% 

Catching Class Selection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 10-13-2005 , 15:35   Catching Class Selection
Reply With Quote #1

Does anyone know how to determine when the player has selected a class? To clarify, when choosing a team, you first select your team, and then a class. I want to determine when the class has been selected. I don't care what class. Just that any class has been chosen, thus the player is formally in the game.
Brad is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-13-2005 , 15:37  
Reply With Quote #2

For which mod?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 10-13-2005 , 16:01  
Reply With Quote #3

I believe he's talking about CS with VGUI menus, we were discussing this earlier in IRC and I told him to take a look at the WeaponMod Lite plugin that I ported.

I assume you couldn't find a way to hook the menu? ;\
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 10-13-2005 , 16:35  
Reply With Quote #4

Yes, CS.

The best I've been able to do thus far is to determine when the "select class" menu appears. Haven't been able to get to the other side yet.
Brad is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-13-2005 , 21:25  
Reply With Quote #5

Sorry that it's got all the surf stuff in it, but that's what I used it for. This is the best I've been able to do to check when someone has selected their model:

EDIT: Also ignore "client_putinserver", it calls some stuff that's really irrelevant to this particular thing.

Code:
new g_lastmodel[33] = {0,...}; /*     CS_DONTCHANGE = 0,     CS_CT_URBAN = 1,     CS_T_TERROR = 2,     CS_T_LEET = 3,     CS_T_ARCTIC = 4,     CS_CT_GSG9 = 5,     CS_CT_GIGN = 6,     CS_CT_SAS = 7,     CS_T_GUERILLA = 8,     CS_CT_VIP = 9 */

Code:
register_event("TextMsg","join_respawn","a","1=1","2&Game_join_te","2&Game_join_ct");

Code:
public join_respawn() {     if(surfmap == false || !get_cvar_num("surf_on") || !get_cvar_num("surf_respawn"))     {         return 0;     }         new arg[32];     read_data(3,arg,31);         new id = cmd_target(1,arg,0);         if(g_lastmodel[id] == 0)     {         set_task(0.1,"check_model",id,_,_,"b");     }     else     {           // Spawn the player twice to avoid the HL engine bug         set_task(0.5,"player_spawn",id);         set_task(0.7,"player_spawn",id);             // Then give them a suit and a knife         set_task(0.9,"player_giveitems",id);     }         return 0; }

Code:
public check_model(id) {     new model[32];     cs_get_user_model(id,model,31);         if(containi(model,"urban")!=-1)     {         if(g_lastmodel[id]!=1)         {             remove_task(id);                         g_lastmodel[id] = 1;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);                         client_putinserver(id);         }       }     else if(containi(model,"terror")!=-1)     {         if(g_lastmodel[id]!=2)         {             remove_task(id);                         g_lastmodel[id] = 2;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);                         client_putinserver(id);         }       }     else if(containi(model,"leet")!=-1)     {         if(g_lastmodel[id]!=3)         {             remove_task(id);                         g_lastmodel[id] = 3;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);                         client_putinserver(id);         }       }     else if(containi(model,"arctic")!=-1)     {         if(g_lastmodel[id]!=4)         {             remove_task(id);                         g_lastmodel[id] = 4;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);                         client_putinserver(id);         }       }     else if(containi(model,"gsg")!=-1)     {         if(g_lastmodel[id]!=5)         {             remove_task(id);                         g_lastmodel[id] = 5;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);                         client_putinserver(id);         }       }     else if(containi(model,"gign")!=-1)     {         if(g_lastmodel[id]!=6)         {             remove_task(id);                         g_lastmodel[id] = 6;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);             client_putinserver(id);         }       }     else if(containi(model,"sas")!=-1)     {         if(g_lastmodel[id]!=7)         {             remove_task(id);                         g_lastmodel[id] = 7;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);                         client_putinserver(id);         }       }     else if(containi(model,"guerilla")!=-1)     {         if(g_lastmodel[id]!=8)         {             remove_task(id);                         g_lastmodel[id] = 8;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);                         client_putinserver(id);         }       }     else if(containi(model,"vip")!=-1)     {         if(g_lastmodel[id]!=9)         {             remove_task(id);                         g_lastmodel[id] = 9;                         /* Spawn the player twice to avoid the HL engine bug */             set_task(0.5,"player_spawn",id);             set_task(0.7,"player_spawn",id);                 /* Then give them a suit and a knife */             set_task(0.9,"player_giveitems",id);                         client_putinserver(id);         }       } }

Code:
public client_disconnect(id) {     g_lastmodel[id] = 0;         return 0; }

Code:
public client_client_putinserver(id) {     g_lastmodel[id] = 0;     // This is not what it actually is in my script, but it's just to help with this particular instance     return 0; }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 10-13-2005 , 21:28  
Reply With Quote #6

I just breezed through your code, so I may have missed something, but essentially you're just checking to see if the player's model changed from what it was when they spawn, correct?

While that would tell me that they've selected a class, it wouldn't tell me until they spawn, which could be seconds or minutes after they've selected the class. I need to know immediately.
Brad is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-13-2005 , 21:28  
Reply With Quote #7

No actually it does tell you right away. Try it before you dismiss it.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 10-13-2005 , 21:32  
Reply With Quote #8

I will try it.

In the meantime, I'd appreciate it if you could read what I wrote again and tell me where I was dismissive.
Quote:
Originally Posted by Brad
I just breezed through your code, so I may have missed something, but essentially you're just checking to see if the player's model changed from what it was when they spawn, correct?
The bolded portions are of note. They indicate that I acknowledge that I could be wrong and that I'm asking for verification. The portion of my post that I didn't quote is based on the assumption that I was correct.
Brad is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 10-13-2005 , 21:33  
Reply With Quote #9

Sigh, yes that's basically what it does. I haven't bumped into anything else that has been able to do it and therefore had to make a stupid and hackish method myself.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-13-2005 , 21:33  
Reply With Quote #10

I was testing in preThink comparing cs_get_user_model, the problem is that by default (upon joining) it is "urban", so if you picked the urban model itself there would be no change and it wouldn't signal that you have selected your "class."
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 00:05.


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