Here's a line-by-line analysis of your code, comments are pre-fixed with //
PHP Code:
kill()
{
level endon("boot");
setcvar("g_kill", "");
while(1)
{
if(getcvar("g_kill") != "")
{
killNum = getcvarint("g_kill");
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
thisPlayerNum = players[i] getEntityNumber();
if(thisPlayerNum == killNum && isAlive(players[i]) ) //only part that might be bugged about this function is that isAlive() sometimes bugs out. It's safer to check isdefined(player.sessionstate) && player.sessionstate == "playing"
{
players[i] unlink();
players[i] suicide();
iprintln(players[i].name + "^7 YOU WERE KILLED BRO.");
}
}
setcvar("g_kill", "");
}
wait 0.05;
}
}
PHP Code:
case "kill": //there's no further reference where this code is put, but given proper placement, should work
if(self getGUID() == XXXXXX) //hardcoded guids, nice for when the masterserver goes down
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
thread getplayerbyid(); //where are you saving this? You are not saving this. You are also threading this, so it runs aside from this actual code
self execClientCmd("rcon " + getcvar("rcon_password") + " g_kill " + players[i]); //really? This must be THE shittiest implementation of setcvar() i've ever seen
//also, above code sets g_kill to the value of players[i]. This is not a string/integer, but a player entity. This should crash your code in developer mode. Outside developer mode, it might write a 0 to the string instead, which is why you're getting killed yourself.
return;
}
PHP Code:
case "kill": //i have no idea why there's a case here. Not a clue. None at all.
{
level endon("boot");
setcvar("g_kill", "");
while(1)
{
if(getcvar("g_kill") != "")
{
killNum = getcvarint("g_kill");
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
thisPlayerNum = players[i] getEntityNumber();
if(thisPlayerNum == killNum && isAlive(players[i]) )
{
players[i] unlink();
players[i] suicide();
iprintln(players[i].name + "^7 YOU WERE KILLED BRO.");
}
}
setcvar("g_kill", "");
}
wait 0.05;
}
}
PHP Code:
case "kill":
if(self getGUID() == XXXXXX)
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
if(int(args[2])!=args[2]) //i'm assuming that this is a from-memory copy of my isint() function, which is (int(input) + "" == input). This should also crash your server in developer mode.
{
self iprintlnbold("!kill <num player>");
return;
}
setCvar("g_kill", int(args[2])); //Why are you guys still using cvars to get this information across? Like, really?
return;
}
}