I don't know what exactly you're trying to achieve.
The following script will allow alive terrorists to run the command once per round.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
new bool:g_bCmdUsed[MAXPLAYERS+1];
public OnPluginStart()
{
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
RegConsoleCmd("sm_wdh", Command_Wdh);
}
public OnClientConnected(client)
{
if (g_bCmdUsed[client]) {
g_bCmdUsed[client] = false;
}
}
public OnClientDisconnect(client)
{
if (g_bCmdUsed[client]) {
g_bCmdUsed[client] = false;
}
}
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
for (new i = 1; i <= MaxClients; i++) {
if (g_bCmdUsed[i]) {
g_bCmdUsed[i] = false;
}
}
}
public Action:Command_Wdh(client, args)
{
if (!client) {
ReplyToCommand(client, "You cannot run this command through the server console.");
return Plugin_Handled;
}
if (GetClientTeam(client) == 2) {
if (g_bCmdUsed[client]) {
ReplyToCommand(client, "You can run this command once per round only.");
return Plugin_Handled;
}
if (!IsPlayerAlive(client)) {
ReplyToCommand(client, "Only alive terrorists can run this command.");
return Plugin_Handled;
}
PrintToChatAll("%N möchte die Ansagen wiederholt haben", client);
g_bCmdUsed = true;
} else {
ReplyToCommand(client, "Only alive terrorists can run this command.");
}
return Plugin_Handled;
}