CMD:am(playerid, params[])
{
if(IsAdmin(playerid))
{
new toid, message[65];
if(sscanf(params, "us[65]", toid, message)) return Syntax(playerid, "[a]dmin[m]essage: [playerid] [message]");
if(strlen(message) > 65) return Error(playerid, "Your message cannot be longer than 65 characters.");
if(!IsPlayerConnected(toid)) return Error(playerid, "That player is not connected!");
new string[128];
format(string, sizeof(string), "Admin message from %s: %s", GetPlayerNameEx(playerid), message);
SendClientMessageEx(toid, COLOR_GREEN, string);
format(string, sizeof(string), "Admin %s [%d] > %s [%d]: %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(toid), toid, message);
SendAdminMessage(COLOR_GREEN,string);
}
else
{
new message[80];
if(sscanf(params, "s[80]", message)) return Syntax(playerid, "[a]dmin[m]essage: [message]");
if(strlen(message) > 80) return Error(playerid, "Your message cannot be longer than 80 characters.");
new string[128];
format(string, sizeof(string), "Admin message from %s [%d]: %s", GetPlayerNameEx(playerid), playerid, message);
SendAdminMessage(COLOR_GREEN,string);
format(string, sizeof(string), "Your message, %s, has been sent.", message);
SendClientMessageEx(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Player %s [%d] > Admins: %s", GetPlayerNameEx(playerid), playerid, message);
}
return 1;
}
Usage:/[a]dmin[m]essage [Text]
Usage:/[a]dmin[m]essage [Playerid] [Text]
CMD:am(playerid, params[])
{
if(IsAdmin(playerid))
{
new toid, message[128];
if(sscanf(params, "us[128]", toid, message)) return Syntax(playerid, "[a]dmin[m]essage: [playerid] [message]");
if(strlen(message) > 65) return Error(playerid, "Your message cannot be longer than 65 characters.");
if(!IsPlayerConnected(toid)) return Error(playerid, "That player is not connected!");
new string[128];
format(string, sizeof(string), "Admin message from %s: %s", GetPlayerNameEx(playerid), message);
SendClientMessageEx(toid, COLOR_GREEN, string);
format(string, sizeof(string), "Admin %s [%d] > %s [%d]: %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(toid), toid, message);
SendAdminMessage(COLOR_GREEN,string);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: This message is for administrators only!");
}
return 1;
}
/am [Text]
/am [ID] [Text]
//removed due to being wrong
C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48198) : error 028: invalid subscript (not an array or too many subscripts): "IsAdmin" C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48198) : warning 215: expression has no effect C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48198) : error 001: expected token: ";", but found "]" C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48198) : error 029: invalid expression, assumed zero C:\Users\Win 7\Downloads\Compressed\LSRP.pwn(48198) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
if(IsAdmin[playerid])
stock IsAdmin( playerid )
{
if(PlayerInfo[playerid][pAdmin]<=2) return 1;
return 0;
}
new AMReplyId[MAX_PLAYERS];
CMD:am(playerid, params[])
{
if(IsAdmin[playerid])
{
new toid, message[65];
if(sscanf(params, "us[65]", toid, message)) return SendClientMessageEx(playerid, COLOR_WHITE,"USAGE: /[a]dmin[m]essage [playerid] [message]");
if(strlen(message) > 65) return SendClientMessageEx(playerid, COLOR_RED,"Your message cannot be longer than 65 characters.");
if(!IsPlayerConnected(toid)) return SendClientMessageEx(playerid, COLOR_RED,"That player is not connected!");
new string[128];
format(string, sizeof(string), "Admin message from %s: %s", GetPlayerNameEx(playerid), message);
SendClientMessageEx(AMReplyId[playerid], COLOR_GREEN, string);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsAdmin[i])
{
format(string, sizeof(string), "Admin %s [%d] > %s [%d]: %s", GetName(playerid), playerid, GetName(toid), toid, message);
SendClientMessageEx(i,COLOR_GREEN,string);
}
}
}
else
{
new message[80];
if(sscanf(params, "s[80]", message)) return SendClientMessageEx(playerid, COLOR_WHITE,"USAGE: /am [message]");
if(strlen(message) > 80) return SendClientMessageEx(playerid, COLOR_RED,"Your message cannot be longer than 80 characters.");
new string[128];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsAdmin[i])
{
format(string, sizeof(string), "Admin message from %s [%d]: %s", GetPlayerNameEx(playerid), playerid, message);
SendClientMessageEx(i,COLOR_GREEN,string);
AMReplyId[i] = playerid;
}
}
format(string, sizeof(string), "Your message, %s, has been sent.", message);
SendClientMessageEx(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Player %s [%d] > Admins: %s", GetPlayerNameEx(playerid), playerid, message);
}
return 1;
}
#define Syntax(%0,%1) SendClientMessage(%0, 0xFFFF00FF, %1)
#define Error(%0,%1) SendClientMessage(%0, 0xFF0000FF, %1)
CMD:am(playerid, params[])
{
if(IsAdmin(playerid))
{
new toid, message[65];
if(sscanf(params, "us[65]", toid, message)) return SendClientMessageEx(playerid, COLOR_WHITE,"USAGE: /[a]dmin[m]essage [playerid] [message]");
if(strlen(message) > 65) return SendClientMessageEx(playerid, COLOR_RED,"Your message cannot be longer than 65 characters.");
if(!IsPlayerConnected(toid)) return SendClientMessageEx(playerid, COLOR_RED,"That player is not connected!");
new string[128];
format(string, sizeof(string), "Admin message from %s: %s", GetPlayerNameEx(playerid), message);
SendClientMessageEx(AMReplyId[playerid], COLOR_GREEN, string);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsAdmin(i))
{
format(string, sizeof(string), "Admin %s [%d] > %s [%d]: %s", GetName(playerid), playerid, GetName(toid), toid, message);
SendClientMessageEx(i,COLOR_GREEN,string);
}
}
}
else
{
new message[80];
if(sscanf(params, "s[80]", message)) return SendClientMessageEx(playerid, COLOR_WHITE,"USAGE: /am [message]");
if(strlen(message) > 80) return SendClientMessageEx(playerid, COLOR_RED,"Your message cannot be longer than 80 characters.");
new string[128];
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsAdmin(i))
{
format(string, sizeof(string), "Admin message from %s [%d]: %s", GetPlayerNameEx(playerid), playerid, message);
SendClientMessageEx(i,COLOR_GREEN,string);
AMReplyId[i] = playerid;
}
}
format(string, sizeof(string), "Your message, %s, has been sent.", message);
SendClientMessageEx(playerid, COLOR_GREEN, string);
format(string, sizeof(string), "Player %s [%d] > Admins: %s", GetPlayerNameEx(playerid), playerid, message);
}
return 1;
}
Here is the whole command with Defines
pawn Код:
|