Raised This Month: $51 Target: $400
 12% 

[TF2] Addcond


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dispenz0r
Member
Join Date: May 2011
Old 11-08-2012 , 14:28   --------------------
Reply With Quote #1

--------------------

Last edited by Dispenz0r; Yesterday at 16:22.
Dispenz0r is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 11-08-2012 , 15:49   Re: [TF2] Addcond
Reply With Quote #2

PHP Code:
#include <tf2>

public Plugin:myinfo =
{
    
name "TF2 Add Condition",
    
author "Tylerst",
    
description "Add a condition to the target(s)",
    
version "1.0.0",
    
url "None"
}

public 
OnPluginStart()
{
    
LoadTranslations("common.phrases");
    
RegAdminCmd("sm_addcond"Command_AddConditionADMFLAG_GENERIC"Add a condition to the target(s), Usage: sm_addcond \"target\" \"condition number\" \"duration\"");
    
RegAdminCmd("sm_removecond"Command_RemoveConditionADMFLAG_GENERIC"Add a condition to the target(s), Usage: sm_removecond \"target\" \"condition number\"");
}

public 
Action:Command_AddCondition(clientargs)
{

    if(
args != 3)
    {
        
ReplyToCommand(client"[SM] Usage: sm_addcond \"target\" \"condition number\" \"duration\"");
        return 
Plugin_Handled;
    }

    new 
String:strBuffer[MAX_NAME_LENGTH], String:target_name[MAX_TARGET_LENGTH], target_list[MAXPLAYERS], target_countbool:tn_is_ml;
    
GetCmdArg(1strBuffersizeof(strBuffer));
    if ((
target_count ProcessTargetString(strBufferclienttarget_listMAXPLAYERSCOMMAND_FILTER_ALIVEtarget_namesizeof(target_name), tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }

    new 
iConditionFloat:flDuration;

    
GetCmdArg(2strBuffersizeof(strBuffer));
    
iCondition StringToInt(strBuffer);

    
GetCmdArg(3strBuffersizeof(strBuffer));
    
flDuration StringToFloat(strBuffer);    

    for(new 
0target_counti++)
    {
        
TF2_AddCondition(target_list[i], TFCond:iConditionflDuration);
    }
    return 
Plugin_Handled;
}

public 
Action:Command_RemoveCondition(clientargs)
{

    if(
args != 2)
    {
        
ReplyToCommand(client"[SM] Usage: sm_removecond \"target\" \"condition number\"");
        return 
Plugin_Handled;
    }

    new 
String:strBuffer[MAX_NAME_LENGTH], String:target_name[MAX_TARGET_LENGTH], target_list[MAXPLAYERS], target_countbool:tn_is_ml;
    
GetCmdArg(1strBuffersizeof(strBuffer));
    if ((
target_count ProcessTargetString(strBufferclienttarget_listMAXPLAYERSCOMMAND_FILTER_ALIVEtarget_namesizeof(target_name), tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }

    new 
iCondition;

    
GetCmdArg(2strBuffersizeof(strBuffer));
    
iCondition StringToInt(strBuffer);

    for(new 
0target_counti++)
    {
        
TF2_RemoveCondition(target_list[i], TFCond:iCondition);
    }
    return 
Plugin_Handled;

Tylerst is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 11-08-2012 , 18:45   Re: [TF2] Addcond
Reply With Quote #3

No extra scripting involved, it's a full plugin. Just compile(With either the online compiler or the one that comes with sourcemod) and install.

Commands are:
sm_addcond "target" "condition number" "duration"
sm_removecond "target" "condition number"
Tylerst is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode