[Tutorial] How to make simple OOC command for roleplay servers.
#1

Hello, today I will show you how to make a simple Out Of Character command.

Let's start with the first step:

Defines / Includes.

Код:
#include <zcmd>
#include <sscanf2>
The color that we will use.

Код:
#define COLOR_GRAY 0xAFAFAFAA
Now we are done. Let's use our zcmd to make the command.

Код:
CMD:ooc(playerid, params[])
{
Okay this part is easy just goin to add the string that we will use. Which will be string [128] just like this

Код:
new string[128];
See? easy.. Let's go now for the Syntax part in case someone just wrote /o without the text. He gets ERROR: /o <text>

Код:
if(isnull(params)) return SendClientMessage(playerid, COLOR_GRAY, "ERROR: /ooc <text>");
Okay. Your doing great. Last part is the message that will be sent to the whole server when u use this command.

Код:
format(string, sizeof(string), "[OOC-Chat] %s: (( %s ))", GetPlayerNameEx(playerid), params);
SendClientMessageToAll(COLOR_GRAY, string);
Finally we do
Код:
return 1;
}
So here's the whole code.

Код:
CMD:ooc(playerid, params[])
{
  new string[128];
  if(isnull(params)) return SendClientMessage(playerid, COLOR_GRAY, "ERROR: /ooc <text>");
  format(string, sizeof(string), "[OOC-Chat] %s: (( %s ))", GetPlayerNameEx(playerid), params);
  SendClientMessageToAll(COLOR_GRAY, string);
  return 1;
}
I hope you like my tutorial because it's the first tutorial I make on sa-mp forums.
Reply
#2

You're not explaining anything.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)