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:
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);
}
}
}