Skip to content

added sm_pad_toggle #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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 plugins/engipads.smx
Binary file not shown.
26 changes: 26 additions & 0 deletions scripting/engipads.sp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public void OnPluginStart()

RegConsoleCmd("sm_pad", TogglePadsMenuCmd);
RegConsoleCmd("sm_pads", TogglePadsMenuCmd);
RegConsoleCmd("sm_pad_toggle", TogglePadsCmd);
RegConsoleCmd("sm_pad_help", ShowPadsInfoCmd);
RegConsoleCmd("sm_padhelp", ShowPadsInfoCmd);

Expand Down Expand Up @@ -881,6 +882,31 @@ int CreatePadParticle(int iPad)
}

/* Commands */

public Action TogglePadsCmd(int iClient, int nArgs)
{
if (!iClient) //if client was the server console
{
ReplyToCommand(iClient, "This command can only be used in-game!");
return Plugin_Handled;
}

bool updated = GetClientPadsEnabled(iClient)? false : true;

if (!updated) //Enabled EngiPads
{
CPrintToChat(iClient, "{orange}[EngiPads]{default} %t", "padphrase_enabled");
}
else //Disabled EngiPads
{
CPrintToChat(iClient, "{orange}[EngiPads]{default} %t", "padphrase_disabled");
}

SetClientPadsEnabled(iClient, updated);

return Plugin_Handled;
}

public Action TogglePadsMenuCmd(int iClient, int nArgs)
{
if (!iClient) //if client was the server console
Expand Down