Quote:
Originally Posted by N1uddey
For example, someone says '!ex'.
The count now is 1, he says '!ex' again and the count will be 2.
But the max of count is 5.
So how to set the plugin to solve this?
Each person’s count is separate and reset at the beginning of the next round.
I would be very grateful if you can help me.
|
PHP Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION "0.00"
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
int counter[MAXPLAYERS + 1];
public Plugin myinfo =
{
name = "",
author = PLUGIN_AUTHOR,
description = "",
version = PLUGIN_VERSION,
url = ""
};
public void OnPluginStart()
{
RegConsoleCmd("sm_ex", ExCommand);
HookEvent("round_start", OnRoundStart);
}
public void OnClientConnected(int client)
{
counter[client] = 0;
}
public Action ExCommand(int client, int args)
{
counter[client]++;
if(counter[client]>5)
counter[client] = 5;
PrintToChat(client, "The count is %d", counter[client]);
}
public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast)
{
for(int i = 1; i <= MaxClients; ++i)
{
if(IsClientInGame(i) && !IsFakeClient(i))
counter[i] = 0;
}
}
__________________