Raised This Month: $32 Target: $400
 8% 

Timer Auto-cancelling?


Post New Thread Reply   
 
Thread Tools Display Modes
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
sdz
Senior Member
Join Date: Feb 2012
Old 04-03-2017 , 05:14   Re: Timer Auto-cancelling?
Reply With Quote #2

might be throwing you an error
sdz is offline
NewbSkiddy
Junior Member
Join Date: Mar 2017
Old 04-03-2017 , 07:27   Re: Timer Auto-cancelling?
Reply With Quote #3

Not throwing me any error since the plugin compiles and runs. But the timer, and only this timer, cancels after two runs.
NewbSkiddy is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 04-03-2017 , 07:34   Re: Timer Auto-cancelling?
Reply With Quote #4

he meant check your error log
8guawong is offline
Rachnus
Senior Member
Join Date: Jun 2016
Location: Funland
Old 04-03-2017 , 08:48   Re: Timer Auto-cancelling?
Reply With Quote #5

You are passing TIMER_REPEAT as a value to the timer. do
PHP Code:
CreateTimer(0.5UpdateList_Timer,_TIMER_REPEAT); 
__________________
Github: https://github.com/jimppan
Steam: http://steamcommunity.com/id/jimppan
_____________________________________________ _________
Taking private requests

Last edited by Rachnus; 04-03-2017 at 08:48.
Rachnus is offline
Reply


Thread Tools
Display Modes

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 13:22.


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