Quote:
Originally Posted by farawayf
upd include
PHP Code:
#include <sourcemod>
#pragma newdecls required
public void OnPluginStart() {
RegAdminCmd("sm_cheats", cheats, ADMFLAG_CONVARS);
}
public Action cheats(int client, int args) {
if(args < 1) {
ReplyToCommand(client, "[SM] Usage: sm_cheats <value>");
return Plugin_Handled;
}
char arg[4];
GetCmdArg(1, arg, sizeof(arg));
if(StrEqual(arg, "1")) {
ServerCommand("sv_cheats 1");
PrintToChat(client, "\x04svcheats is *on*");
}
else if(StrEqual(arg, "0")) {
ServerCommand("sv_cheats 0");
PrintToChat(client, "\x03svcheats is *off*");
}
return Plugin_Handled;
}
|
thanks for the code, But i am trying to understand the logic for improve.
a few questions,
is this the actual scan commnad? GetCmdArg(1, arg, sizeof(arg));?
if so, what does the one means? i understood that args is a char array, and the sizeof(args) means the bytes (am i even right?), but what does the one means?
when will args will be lower then one? when there is none? like cheats <nothing>?
thanks!