View Single Post
ici
Member
Join Date: Jan 2014
Old 02-17-2015 , 16:36   Re: HEL Plugin Timer and only for T´s and alive
Reply With Quote #2

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_RoundStartEventHookMode_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 
1<= MaxClientsi++) {
        if (
g_bCmdUsed[i]) {
            
g_bCmdUsed[i] = false;
        }
    }
}

public 
Action:Command_Wdh(clientargs)
{
    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;

ici is offline