19.02.2014, 11:49
How-To: Make Admin/Team Chats!
Hello. Today, I'll be showing you how you can make admin chats/team chats, and more! Let's get started. You'll need some basic thing's to do this tutorial, how-ever. Those things can be found below:**Basic PAWN Scripting Knowledge**
**Pawno/Compiler(Version 0.3x or 0.3z is recommended.)
Alright, so we'll be using some includes as found below:
Code:
#include a_samp // Of-Course! #include zcmd #include foreach // If you prefer using the MAX_PLAYERS method feel free to comment this out.
Code:
#define COLOR_CHAT -1 // Replace this with what-ever color you want the chat(color) to be.
Making a chat for RCON Admins(foreach version):
We'll need to set up our command...
Code:
CMD:achat(playerid, params[]) { return 1; }
Code:
if(!IsPlayerAdmin(playerid)) return 0;
Code:
if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /achat [text]");
Code:
new string[128];
Code:
stock GetPName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); return name; }
Code:
format(string, sizeof(string), "RCON Admin %s: %s", GetPName(playerid), params); foreach(Player, i) { if(IsPlayerAdmin(i)) return SendClientMessage(playerid, COLOR_CHAT, string); } return 1; }
Code:
#include a_samp #include zcmd #include foreach #define COLOR_CHAT -1 CMD:achat(playerid, params[]) { if(!IsPlayerAdmin(playerid)) return 0; if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /achat [text]"); new string[128]; format(string, sizeof(string), "RCON Admin %s: %s", GetPName(playerid), params); foreach(Player, i) { if(IsPlayerAdmin(i)) return SendClientMessage(playerid, COLOR_CHAT, string); } return 1; } stock GetPName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); return name; }
If you have any questions, or comments, just reply or PM me!
- Abagail