[HR/SR:FS] Fast rcon command processor: RCMD (modified DCMD)
#1

Ovo sam napravio već neko vrijeme nazad ali kad sam vidio ovo onda sam se odlućio da ću i ja postat svoju verziju.

Znaći, ovo radi isto kao dcmd ali samo je razlika da je ova funkcija za rcon komande.

Funkcija:
Code:
#if !defined RCMD_PREFIX
#define RCMD_PREFIX "/"
#endif
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
Primjer:
Code:
public OnRconCommand(cmd[])
{
  rcmd(amsg, 4, cmd); // because amsg has 4 characters.
  return 0;
}

// EXAMPLE RCON-CONSOLE COMMAND:
rcmd_amsg(command[])
{
  if(!strlen(command))
  {
    printf("Correct usage: '%samsg [text]'", RCMD_PREFIX);
    return 1;
  }
  SendClientMessageToAll(0xFF0000AA, command);
  printf("Admin: %s", command);
  return 1;
}
Zasluge:
DracoBlue - [HowTo] Fast command processor: DCMD (0.2 Ready)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)