View Single Post
Author Message
JoinedSenses
Senior Member
Join Date: Sep 2013
Old 11-03-2019 , 23:04   [INC] Queue - FIFO
Reply With Quote #1

Based on some discussion via SM discord, I created a queue methodmap which inherits from Handle and utilizes arraylist methods. Unlike ArrayStack, this methodmap is First In, First Out.

Code can be found here:
queue.inc

Simple example usage:

Code:
#include <sourcemod>
#include <queue>

public void OnPluginStart() {
	RegAdminCmd("sm_test", cmdTest, ADMFLAG_ROOT);
}

public Action cmdTest(int client, int args) {
	Queue q = new Queue();

	for (int i = 1; i <= 10; i++) {
		q.Push(i);	
	}

	while (!q.Empty) {
		ReplyToCommand(client, "%i", q.Pop());
	}

	delete q;

	return Plugin_Handled;
}
__________________

Last edited by JoinedSenses; 11-03-2019 at 23:58.
JoinedSenses is offline