public OnPlayerText(playerid, text[])
{
if(text[0] == '#')
{
strdel(text, 0, 1);
foreach(Player, i)
{
if(!IsPlayerAdmin(i)) continue;
SendClientMessage(i, -1, text);
return 0;
}
}
return 1;
}
if(text[0] == '#')
{
// Setup local variables
new Name[24], Msg[128], Message[128];
// Send the command to all admins so they can see it
SendAdminText(playerid, "#", params);
// Get the player's name
GetPlayerName(playerid, Name, sizeof(Name));
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player is an admin
if (APlayerData[playerid][PlayerLevel] > 0)
{
if (sscanf(params, "s[128]", Message)) SendClientMessage(playerid, 0xFF0000AA, "[SERVER] Usage: \"# <Your Message>\"");
else
{
// Loop through all players
for (new i; i < MAX_PLAYERS; i++)
{
// Check if the player is logged in
if (APlayerData[i][LoggedIn] == true)
{
// Check if the other player is also an admin
if (APlayerData[i][PlayerLevel] > 0)
{
format(Msg, 128, "[ADMIN CHAT] {faff00}%s: {faff00}%s", Name, Message);
SendClientMessage(i, 0xfaff00FF, Msg);
}
}
}
}
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
(19456) : error 017: undefined symbol "params" (19467) : error 017: undefined symbol "params"
if(text[0] == '#') {
strdel(text, 0, 1);
strins(text, "[ADMIN CHAT]: ", 0);
// Your message is in 'text'
}
|
Return Values: Returning 0 in this callback will stop the text from being sent to all players. It is always called first in filterscripts so returning 0 there blocks other scripts from seeing it. |