16.03.2013, 05:24
I'm not going to spoon feed it to you, but I'll show you how to create one.
Let's start by creating a new stock - SendClientMessageToAdmins.
Now that we have our stock, we can easily make a /report command that will send it to all online admins.
Let's start by creating a new stock - SendClientMessageToAdmins.
pawn Код:
stock SendClientMessageToAdmins(color, const message[]) // We create the stock. You'll need the color, and the message that will be sent.
{
for(new i = 0; i < MAX_PLAYERS; i++) //we loop through the players, to check who's an admin and who is not.
{
if(PlayerInfo[i][pAdmin] >= 1) // If they're an admin, they will receive the message.
{
SendClientMessage(i, color, message); //You'll need to SendClientMessageToAdmins(color, message.)
}
}
return true;
}
pawn Код:
CMD:report(playerid, params[])
{
new string[128], reason[128]; // We create the string that will be sent to the admins, and the reason.
if(sscanf(params, "s[128]",reason))return SendClientMessage(playerid, COLOR_WHITE, " USAGE: /report [reason]"); //We make it so they'll need to use /report [reason].
format(string, sizeof(string), "Report from: %s[ID:%d]:{DBED15} %s", GetName(playerid), playerid, reason); //We format our string, so we can send it to the online administrators.
SendClientMessageToAdmins(COLOR_TAN, string); //And here's our stock. We SendClientMessageToAdmins our previous string.
SendClientMessage(playerid, COLOR_TAN, "Your report has been sent."); //we then send a message to the player, saying their report was successfully sent.
return 1;
}