Raised This Month: $ Target: $400
 0% 

Timer Auto-cancelling?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
NewbSkiddy
Junior Member
Join Date: Mar 2017
Old 04-03-2017 , 04:53   Timer Auto-cancelling?
Reply With Quote #1

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
NewbSkiddy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode