I apologize if this is in the wrong section but I cant get this plugin to work. I dont have access to the server logs so I tested it out on my own local server
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <ctfplayersharedcond>
#include <tf2>
public Plugin:myinfo =
{
name = "CTFPlayerShared Conditions Examples",
author = "Wazz",
description = "CTFPlayerShared Conditions examples",
version = "0.0.9.0",
url = "http://www.sourcemod.net/"
};
public OnPluginStart()
{
LoadTranslations("common.phrases");
RegAdminCmd("sm_addcondition", cmd_AddCondition, ADMFLAG_KICK, "Adds a condition to the target");
RegAdminCmd("sm_removecondition", cmd_RemoveCondition, ADMFLAG_KICK, "Removes a condition from the target");
}
public OnConditionAdded(Client, PlayerCondition:condition)
{
PrintToChatAll("OnConditionAdded for %N: %i", Client, condition);
return;
}
public OnConditionRemoved(Client, PlayerCondition:condition)
{
PrintToChatAll("OnConditionRemoved for %N: %i", Client, condition);
return;
}
public Action:cmd_AddCondition(Client, args)
{
if (args != 2)
{
ReplyToCommand(Client, "[SM] Usage: sm_addcondition <target> <condition>");
return Plugin_Handled;
}
decl String:buffer[64];
decl String:target_name[MAX_NAME_LENGTH];
decl target_list[MAXPLAYERS];
decl target_count;
decl bool:tn_is_ml;
GetCmdArg(1, buffer, sizeof(buffer));
if ((target_count = ProcessTargetString(
buffer,
Client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(Client, target_count);
return Plugin_Handled;
}
new PlayerCondition:cond;
GetCmdArg(2, buffer, sizeof(buffer));
cond = PlayerCondition:StringToInt(buffer);
for (new i = 0; i < target_count; i++)
{
AddCondition(target_list[i], cond);
ShowActivity2(Client, "[SM] ", "given %N condition %i.", target_list[i], cond);
}
return Plugin_Handled;
}
public Action:cmd_RemoveCondition(Client, args)
{
if (args != 2)
{
ReplyToCommand(Client, "[SM] Usage: sm_removecondition <target> <condition>");
return Plugin_Handled;
}
decl String:buffer[64];
decl String:target_name[MAX_NAME_LENGTH];
decl target_list[MAXPLAYERS];
decl target_count;
decl bool:tn_is_ml;
GetCmdArg(1, buffer, sizeof(buffer));
if ((target_count = ProcessTargetString(
buffer,
Client,
target_list,
MAXPLAYERS,
COMMAND_FILTER_ALIVE,
target_name,
sizeof(target_name),
tn_is_ml)) <= 0)
{
ReplyToTargetError(Client, target_count);
return Plugin_Handled;
}
new PlayerCondition:cond;
GetCmdArg(2, buffer, sizeof(buffer));
cond = PlayerCondition:StringToInt(buffer);
for (new i = 0; i < target_count; i++)
{
RemoveCondition(target_list[i], cond);
ShowActivity2(Client, "[SM] ", "removed condition %i from %N.", cond, target_list[i]);
}
return Plugin_Handled;
}
For the record, the topic this was on was really old so I didnt want to be impolite and bump an old thread.
The error I get is this
PHP Code:
07/28/2010 - 20:02:49: [SM] Native "AddCondition" reported: Failed to locate function
L 07/28/2010 - 20:02:49: [SM] Displaying call stack trace for plugin "Addcond.smx":
L 07/28/2010 - 20:02:49: [SM] [0] Line 75, Addcond.sp::cmd_AddCondition()