#if !defined RCMD_PREFIX
#define RCMD_PREFIX "/"
#endif
#if !defined rcmd
#define rcmd(%1,%2,%3) if((strcmp((%3), RCMD_PREFIX #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (rcmd_%1(""))) || (((%3)[(%2) + 1] == 32) && (rcmd_%1((%3)[(%2) + 2]))))) return 1
#endif
public OnRconCommand(cmd[])
{
rcmd(amsg, 4, cmd); // Because amsg has 4 characters.
return false;
}
// Example RCON-console command:
rcmd_amsg(command[])
{
if(!strlen(command))
{
printf("Correct usage: \"%samsg [text]\"", RCMD_PREFIX);
return true;
}
SendClientMessageToAll(0xFF0000AA, command);
printf("Admin: %s", command);
return true;
}
Originally Posted by aspire5630
Don't you need permsion if its a edit?
and i don't really understand |
Known bugs: Somehow you can use rcmd commands if you use /, !, ? or any other character in front of the command. |
#define rcmd(%1,%2,%3) if((strcmp((%3)[1], #%1, true, (%2)) == 0) |
#define rcmd(%1,%2,%3) if((strcmp((%3)[0], #%1, true, (%2)) == 0) |
#define rcmd(%1,%2,%3) if((strcmp((%3), #%1, true, (%2)) == 0) |
#define rcmd(%1,%2,%3) if((strcmp((%3),"/" #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (rcmd_%1(""))) || (((%3)[(%2) + 1] == 32) && (rcmd_%1((%3)[(%2) + 2]))))) return 1
Originally Posted by Goldkiller
Uhm,I guess I understood you now.You want the Rcon cmds to start with '/'.
Code:
#define rcmd(%1,%2,%3) if((strcmp((%3),"/" #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (rcmd_%1(""))) || (((%3)[(%2) + 1] == 32) && (rcmd_%1((%3)[(%2) + 2]))))) return 1 |