Hey! I have this timer, and it only runs twice before stopping, and I can't seem to figure out why. I'm sure it's really obvious, I just miss exactly what's the problem.
Code:
public void OnMapStart()
{
CreateTimer(0.5, UpdateList_Timer, TIMER_REPEAT);
}
My OnMapStart function.
Code:
public Action UpdateList_Timer(Handle Timer)
{
UpdateList();
return Plugin_Continue;
}
void UpdateList()
{
PrintToServer("memes?");
for(int i = 1; i <= MaxClients; i++)
{
clientInFunction = i;
if(IsClientInGame(clientInFunction))
{
playerKills[i] = GetClientFrags(i);
playerID[i] = i;
}
}
for(int i = 1; i <= MaxClients; i++)
{
for(int j = 1; j <= MaxClients; j++)
{
if(playerKills[j]>playerKills[i])
{
disposable = playerKills[j];
playerKills[j] = playerKills[i];
playerKills[i] = disposable;
disposable = playerID[j];
playerID[j] = playerID[i];
playerID[i] = disposable;
}
}
}
for(int i = 1; i<=winners; i++)
{
top[i] = playerID[i];
PrintToChatAll("memes");
}
}
The Code that I want to run.
Code:
int winners = 3;
const int STUPIDVARIABLE = 10;
int top[STUPIDVARIABLE];
int playerKills[MAXPLAYERS];
int playerID[MAXPLAYERS];
int disposable = 0;
int clientInFunction = 0;
Some of the global variables I use