PHP Code:
public Action cheats(int client, int args) {
/* if arguments less than 1, then print to client and return. This will be called if player types the command without
arguments. Like "!cheats"
*/
if(args < 1) {
ReplyToCommand(client, "[SM] Usage: sm_cheats <value>");
return Plugin_Handled;
}
char arg[4]; //creating char with any name, "arg" for example.
GetCmdArg(1, arg, sizeof(arg)); //get the first argument of command and store it in char with full size of argument
//then check equal and do stuff
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;
}
GetCmdArg:
https://sm.alliedmods.net/new-api/console/GetCmdArg