SA-MP Forums Archive
[Tutorial] How to make simple OOC command for roleplay servers. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make simple OOC command for roleplay servers. (/showthread.php?tid=392076)



How to make simple OOC command for roleplay servers. - Austain_Jake - 12.11.2012

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.


Respuesta: How to make simple OOC command for roleplay servers. - ThePhenix - 14.11.2012

You're not explaining anything.