View Single Post
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 11-10-2013 , 04:33   Re: [CS:GO] Kill Command
Reply With Quote #3

I would go for a proper way.
PHP Code:
public OnPluginStart() {

  
AddCommandListener(Command_Say"say");
  
AddCommandListener(Command_Say"say_team");
}


public 
Action:Command_Say(client, const String:command[], argc) {

  
decl String:text[128];
  
GetCmdArgString(textsizeof(text));
  new 
bool:bPublic true;
 
  new 
startidx 0;
  if (
text[0] == '"') {
    
startidx++;
    new 
len strlen(text);
    if (
text[len-1] == '"') {
      
text[len-1] = '\0';
    }
  }
 
  
// Here you can specify any signs you want. # for example
  
if (text[startidx] == '!') {
    
startidx++;
  } else if (
text[startidx] == '/') {
    
startidx++;
    
bPublic false;
  } else {
    return 
Plugin_Continue;
  }

  
// Here you can add any text triggers you want to
  
if (StrEqual(text[startidx], "kill"false)) {
    
// This is the actual action function
    
PerformKill(client);
    if (
bPublic) {
      return 
Plugin_Continue;
    } else {
      return 
Plugin_Handled;
    }
  }

  return 
Plugin_Continue;
}

stock PerformKill(client) {

  if (
IsClientInGame(client) && IsPlayerAlive(client)) {
    
ForcePlayerSuicide(client);
  }

Don't make another console command if you just want a chat trigger.

Last edited by xf117; 11-10-2013 at 04:34.
xf117 is offline
Send a message via ICQ to xf117