28.07.2009, 17:54
(
Last edited by Correlli; 14/09/2012 at 10:18 PM.
)
This works on same way as DCMD but only difference is that this function is for RCON commands.
Function:
Example:
Credits:
DracoBlue - [HowTo] Fast command processor: DCMD
Function:
pawn Code:
#if !defined RCMD_PREFIX
#define RCMD_PREFIX "/"
#endif
pawn Code:
#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
pawn Code:
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;
}
DracoBlue - [HowTo] Fast command processor: DCMD