Hello! (Im sorry i make so many threads last days..)
So I took Exolent's HideNSeek plugin and I found a HideNSeek Deathmatch plugin somewhere and fused them. It works perfectly but there is a little glitch.
On hns deathmatch when somebody dies - some CT is taken randomly and becames a T instead. This works too. But when there is no CT on the server and a T dies - It just crashes.
Here is the code for getting a randomCT:
PHP Code:
GetRandomCT()
{
static iPlayers[32], iCT_num;
get_players(iPlayers, iCT_num, "ae", "CT");
if(!iCT_num)
return 0;
return iCT_num > 1 ? iPlayers[random(iCT_num)] : iPlayers[iCT_num - 1];
}
and this is where I use it (this is included in eventDeathMsg):
PHP Code:
new killer = read_data(1);
new victim = read_data(2);
if(killer == 0 && get_user_team(victim) == 1)
{
new lucky = GetRandomCT();
cs_set_user_team(lucky, 1);
client_print(lucky, print_chat, "[HideNSeek] Lucky! Someone let you have their life!");
cs_set_user_team(victim, 2);
SetStealth(lucky);
}