I hope someone reads this thread...
Soo, anyhows, this is what I did:
Code:
public client_connect(id)
{ //Disables the VGUI menus, since they for some
set_user_info(id, "_vgui_menus", "0"); //reason can't be blocked...?
}
public blockteams(id) {
show_menu(id, 0, "work", 1, "#Team_Select_Spect") //Here we block the Team selection
set_task(1.0,"showmenu",id); //menu and go to my new menu
}
public showmenu(id) { //My cool menu, copied almost fully from Emp`'s menu tutorial :D
cs_set_user_team (id, CsTeams:CS_TEAM_SPECTATOR) //Tried this for fixing the problem, won't work
new menu = menu_create("\rChoose team:", "menu_handler")
menu_additem(menu, "\wThe Freeman Team", "1", 0) //First option, "Terrorist team"
menu_additem(menu, "\wThe Government Team", "2", 0) //Second option "CT team"
menu_additem(menu, "\wSpectator", "3", 0) //Third option Spectator
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public menu_handler(id, menu, item) { //Still copied from Emp`'s tutorial...
if (item == MENU_EXIT) {
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key) {
case 1:{
cs_set_user_team (id, CsTeams:CS_TEAM_T, CS_T_LEET) //Here I set the player team
menu_destroy(menu) //to terrorist
return PLUGIN_HANDLED
}
case 2:{
cs_set_user_team (id, CsTeams:CS_TEAM_CT, CS_CT_SAS) //Same for CT...
menu_destroy(menu)
return PLUGIN_HANDLED
}
case 3:{
cs_set_user_team (id, CsTeams:CS_TEAM_SPECTATOR) //..and for SPEC
menu_destroy(menu)
return PLUGIN_HANDLED
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
So basically it works. It block the old teamchooser menu, and starts the new one. And it sets the clients team to the desired one too. But otherwise it doesn't function. With the last code, the player doesn't spawn until the next round (I also tried this making the player spawn right away with the spawn command). Either way, it still doesn't work:
-The player spawns
-There's nothing on the HUD, only players money
-The player can't move from where he spawned
So basically, you can't do anything. Seems as though I need to make CS understand that I've joined the game. Any suggestions on how to do that? I've tried making the client spectator first in various places in the code, but it refuses to work.
__________________