Skip to content

Commit

Permalink
fixed commands from console
Browse files Browse the repository at this point in the history
  • Loading branch information
maxijabase committed Aug 2, 2020
1 parent 973825f commit 09559b8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 29 deletions.
Binary file modified plugins/profilestatus.smx
Binary file not shown.
69 changes: 40 additions & 29 deletions scripting/profilestatus.sp
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,15 @@ public Action Command_Generic(int client, int args) {
GetCmdArg(2, arg2, sizeof(arg2));
GetCmdArg(3, arg3, sizeof(arg3));

if (StrEqual(arg1, "whitelist", false))
OpenWhitelistMenu(client);
if (StrEqual(arg1, "whitelist", false)) {
if (!client) {
ReplyToCommand(client, "You cannot open the menu whitelist from console!");
return Plugin_Handled;
} else {
OpenWhitelistMenu(client);
return Plugin_Handled;
}
}

if (!StrEqual(arg1, "hours", false) && !StrEqual(arg1, "bans", false) && !StrEqual(arg1, "level", false)) {
CReplyToCommand(client, "%t", "Command Generic Usage");
Expand Down Expand Up @@ -828,7 +835,10 @@ public void Command(char[] arg1, char[] arg2, char[] arg3, int client) {

DataPack pack = new DataPack();

pack.WriteCell(GetClientUserId(client));
if (!client)
pack.WriteCell(client);
else
pack.WriteCell(GetClientUserId(client));
pack.WriteString(arg1);
pack.WriteString(arg2);
pack.WriteString(arg3);
Expand All @@ -840,51 +850,52 @@ public void Command(char[] arg1, char[] arg2, char[] arg3, int client) {
public void SQL_Command(Database db, DBResultSet results, const char[] error, DataPack pack) {

pack.Reset();
int client = GetClientOfUserId(pack.ReadCell());
int client;
int whateverarrived = pack.ReadCell();
if(whateverarrived == 0)
client = whateverarrived;
else
client = GetClientOfUserId(whateverarrived);
char arg1[30], arg2[30], arg3[30];
pack.ReadString(arg1, sizeof(arg1));
pack.ReadString(arg2, sizeof(arg2));
pack.ReadString(arg3, sizeof(arg3));
delete pack;

if (!client) {
return;
}

if (StrEqual(arg2, "add")) {

if (db == null) {

LogError("[PS] Error while adding %s to the %s whitelist! %s", arg3, arg1, error);
PrintToServer("[PS] Error while adding %s to the %s whitelist! %s", arg3, arg1, error);
CPrintToChat(client, "[PS] Error while adding %s to the %s whitelist! %s", arg3, arg1, error);
CReplyToCommand(client, "[PS] Error while adding %s to the %s whitelist! %s", arg3, arg1, error);
return;
}

if (results == null) {
if (StrEqual(arg1, "hours", false)) {
CPrintToChat(client, "%t", "Nothing Hour Added", arg3);
CReplyToCommand(client, "%t", "Nothing Hour Added", arg3);
return;
}
if (StrEqual(arg1, "bans", false)) {
CPrintToChat(client, "%t", "Nothing Ban Added", arg3);
CReplyToCommand(client, "%t", "Nothing Ban Added", arg3);
return;
}
if (StrEqual(arg1, "level", false)) {
CPrintToChat(client, "%t", "Nothing Level Added", arg3);
CReplyToCommand(client, "%t", "Nothing Level Added", arg3);

}
}
if (StrEqual(arg1, "hours", false)) {
CPrintToChat(client, "%t", "Successfully Hour Added", arg3);
CReplyToCommand(client, "%t", "Successfully Hour Added", arg3);
return;
}
if (StrEqual(arg1, "bans", false)) {
CPrintToChat(client, "%t", "Successfully Ban Added", arg3);
CReplyToCommand(client, "%t", "Successfully Ban Added", arg3);
return;
}
if (StrEqual(arg1, "level", false)) {
CPrintToChat(client, "%t", "Successfully Level Added", arg3);
CReplyToCommand(client, "%t", "Successfully Level Added", arg3);
return;
}
}
Expand All @@ -895,35 +906,35 @@ public void SQL_Command(Database db, DBResultSet results, const char[] error, Da
{
LogError("[PS] Error while removing %s from the %s whitelist! %s", arg3, arg1, error);
PrintToServer("[PS] Error while removing %s from the %s whitelist! %s", arg3, arg1, error);
CPrintToChat(client, "[PS] Error while removing %s from the %s whitelist! %s", arg3, arg1, error);
CReplyToCommand(client, "[PS] Error while removing %s from the %s whitelist! %s", arg3, arg1, error);
return;
}

if (!results.AffectedRows) {
if (StrEqual(arg1, "hours", false)) {
CPrintToChat(client, "%t", "Nothing Hour Removed", arg3);
CReplyToCommand(client, "%t", "Nothing Hour Removed", arg3);
return;
}
if (StrEqual(arg1, "bans", false)) {
CPrintToChat(client, "%t", "Nothing Ban Removed", arg3);
CReplyToCommand(client, "%t", "Nothing Ban Removed", arg3);
return;
}
if (StrEqual(arg1, "level", false)) {
CPrintToChat(client, "%t", "Nothing Level Removed", arg3);
CReplyToCommand(client, "%t", "Nothing Level Removed", arg3);
return;
}
}

if (StrEqual(arg1, "hours", false)) {
CPrintToChat(client, "%t", "Successfully Hour Removed", arg3);
CReplyToCommand(client, "%t", "Successfully Hour Removed", arg3);
return;
}
if (StrEqual(arg1, "bans", false)) {
CPrintToChat(client, "%t", "Successfully Ban Removed", arg3);
CReplyToCommand(client, "%t", "Successfully Ban Removed", arg3);
return;
}
if (StrEqual(arg1, "level", false)) {
CPrintToChat(client, "%t", "Successfully Level Removed", arg3);
CReplyToCommand(client, "%t", "Successfully Level Removed", arg3);

}
}
Expand All @@ -934,34 +945,34 @@ public void SQL_Command(Database db, DBResultSet results, const char[] error, Da
{
LogError("[PS] Error while issuing check command on %s! %s", arg3, error);
PrintToServer("[PS] Error while issuing check command on %s! %s", arg3, error);
CPrintToChat(client, "[PS] Error while issuing check command on %s! %s", arg3, error);
CReplyToCommand(client, "[PS] Error while issuing check command on %s! %s", arg3, error);
return;
}

if (!results.RowCount) {
if (StrEqual(arg1, "hours", false)) {
CPrintToChat(client, "%t", "Hour Check Not Whitelisted", arg3);
CReplyToCommand(client, "%t", "Hour Check Not Whitelisted", arg3);
return;
}
if (StrEqual(arg1, "bans", false)) {
CPrintToChat(client, "%t", "Ban Check Not Whitelisted", arg3);
CReplyToCommand(client, "%t", "Ban Check Not Whitelisted", arg3);
return;
}
if (StrEqual(arg1, "level", false)) {
CPrintToChat(client, "%t", "Level Check Not Whitelisted", arg3);
CReplyToCommand(client, "%t", "Level Check Not Whitelisted", arg3);
return;
}
}
if (StrEqual(arg1, "hours", false)) {
CPrintToChat(client, "%t", "Hour Check Whitelisted", arg3);
CReplyToCommand(client, "%t", "Hour Check Whitelisted", arg3);
return;
}
if (StrEqual(arg1, "bans", false)) {
CPrintToChat(client, "%t", "Ban Check Whitelisted", arg3);
CReplyToCommand(client, "%t", "Ban Check Whitelisted", arg3);
return;
}
if (StrEqual(arg1, "level", false)) {
CPrintToChat(client, "%t", "Level Check Whitelisted", arg3);
CReplyToCommand(client, "%t", "Level Check Whitelisted", arg3);
return;
}
}
Expand Down

0 comments on commit 09559b8

Please sign in to comment.