Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified addons/sourcemod/plugins/optional/caster_system.smx
Binary file not shown.
22 changes: 22 additions & 0 deletions addons/sourcemod/scripting/caster_system.sp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ bool forbidSelfRegister;

ConVar g_hDisableAddons;

GlobalForward g_hFWD_CasterRegistered;
GlobalForward g_hFWD_CasterUnregistered;

public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
CreateNative("IsClientCaster", Native_IsClientCaster);
CreateNative("IsIDCaster", Native_IsIDCaster);

g_hFWD_CasterRegistered = new GlobalForward("OnCasterRegistered", ET_Ignore, Param_Cell);
g_hFWD_CasterUnregistered = new GlobalForward("OnCasterUnregistered", ET_Ignore, Param_Cell);

RegPluginLibrary("caster_system");
return APLRes_Success;
}
Expand Down Expand Up @@ -232,6 +238,10 @@ Action Cast_Cmd(int client, int args)
casterTrie.SetValue(buffer, true);
CPrintToChat(client, "%t", "SelfCast1");
CPrintToChat(client, "%t", "SelfCast2");

Call_StartForward(g_hFWD_CasterRegistered);
Call_PushCell(client);
Call_Finish();
}

return Plugin_Handled;
Expand All @@ -257,6 +267,10 @@ Action Caster_Cmd(int client, int args)
ReplyToCommand(client, "\x01%t", "RegCasterReply", target);
CPrintToChat(target, "%t", "RegCasterTarget", client);
CPrintToChat(target, "%t", "SelfCast2");

Call_StartForward(g_hFWD_CasterRegistered);
Call_PushCell(target);
Call_Finish();
}
else
{
Expand All @@ -279,6 +293,10 @@ Action NotCasting_Cmd(int client, int args)
CPrintToChat(client, "%t", "Reconnect1");
CPrintToChat(client, "%t", "Reconnect2");

Call_StartForward(g_hFWD_CasterUnregistered);
Call_PushCell(client);
Call_Finish();

// Reconnection to disable their addons
CreateTimer(3.0, Reconnect, client);
}
Expand All @@ -303,6 +321,10 @@ Action NotCasting_Cmd(int client, int args)
{
CPrintToChat(target, "%t", "UnregCasterTarget", client);
NotCasting_Cmd(target, 0);

Call_StartForward(g_hFWD_CasterUnregistered);
Call_PushCell(target);
Call_Finish();
}
ReplyToCommand(client, "\x01%t", "UnregCasterSuccess", target);
}
Expand Down
18 changes: 18 additions & 0 deletions addons/sourcemod/scripting/include/caster_system.inc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ native bool IsClientCaster(int client);
*/
native bool IsIDCaster(const char[] AuthID);

/**
* Called when a client is registered as a caster
*
* @param Client index
*
* @noreturn
*/
forward void OnCasterRegistered(int client);

/**
* Called when a client is unregistered as a caster
*
* @param Client index
*
* @noreturn
*/
forward void OnCasterUnregistered(int client);

public SharedPlugin __pl_caster_system =
{
name = "caster_system",
Expand Down