Called every 2 seconds.
Code(part):
PHP Code:
public plugin_timer()
{
new ts[32];
//alive Terrorists
new tsa[32];
new cts[32];
new tnum;
// alive Terrorists
new tnuma;
new ctnum;
new i;
// Get teams
get_players(ts, tnum, "e", "TERRORIST");
get_players(cts, ctnum, "e", "CT");
//for alive
get_players(tsa, tnuma, "ae", "TERRORIST");
// Enough players?
if(tnum>=mice && ctnum==cats)
{
if(active == 1)
{
//something there
}
else if (active == 3)
{
if (phase == 1)
{
for(i=0; i<tnum; i++)
{
set_user_maxspeed(ts[i], 0.0);
set_user_gravity(ts[i], 1.0);
}
for(i=0; i<ctnum; i++)
{
set_user_maxspeed(cts[i], 0.001);
set_user_gravity(cts[i], 10.0);
}
}
else if (phase == 2)
{
// Change maxspeeds (Ts can't move, CTs can)
for(i=0; i<tnum; i++)
{
set_user_maxspeed(ts[i], 0.001);
set_user_gravity(ts[i], 10.0);
}
for(i=0; i<ctnum; i++)
{
set_user_maxspeed(cts[i], 0.0);
set_user_gravity(cts[i], 1.0);
}
// When alive T are <= CATS and All T >= 6 plugin is killing last 2 alive terrorists
while(tnuma <= cats && tnum >= 6)
{
client_cmd(tsa[i], "kill");
msg("[H&S] Ts, killed due to last 2 alive", 0);
}
}
}
}
}
I've added this to the code:
PHP Code:
while(tnuma <= cats && tnum >= 6)
{
client_cmd(tsa[i], "kill");
msg("[H&S] Ts, killed due to last 2 alive", 0);
}
And with this where there are 2 alives players server is crashing, somebody knows why?
I dont have any idea. Plugin is compiling very well no errors.
__________________