[HELP] SendMessageToAdmins - 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: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] SendMessageToAdmins (
/showthread.php?tid=199745)
[HELP] SendMessageToAdmins - Larsey123IsMe - 16.12.2010
How to make an "SendMessageToAdmins" include?
pawn Код:
#include <SendMessageToAdmins>
Example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/sayhellotoadmins", cmdtext, true, 10) == 0)
{
if(SendMessageToAdmins)
{
new name[MAX_PLAYER_NAME], string[44];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s says: Hello admins :)",name);
SendClientMessageToAll(0xFFFF00AA, string);
return 1;
}
}
return 0;
}
and :P what is the most easy way to script

sscanf, zcmd ,dcmd ,ect..cmd ^^
Re: [HELP] SendMessageToAdmins -
Ash. - 16.12.2010
SendMessageToAdmins doesnt need to be an include...
It can be done in a simple function like so:
pawn Код:
stock SendMessageToAdmins(fromid, colour, msg[])
{
new pName[MAX_PLAYER_NAME], string[128]; //Why 128? 128 is the MAX size of CHAT TEXT
GetPlayerName(fromid, pName, MAX_PLAYER_NAME);
format(string, sizeof(string), "%s: %s", pName, msg);
for(new i; i < GetMaxPlayers(); i++)
{
if(IsPlayerAdmin(i))
{
SendClientMessage(i, colour, string);
}
}
}
Usage: SendMessageToAdmin(The ID of Sender, the Colour of the message, the message (in ""));
Simples
So, using dcmd, if you wanted to do this as a command, you can do
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(amsg, 4, cmdtext);
return 0;
}
dcmd_amsg(playerid, params[])
{
if(!strlen(params)) return SendClientMessage(playerid, SOME_COLOUR, "Usage: /amsg [message]");
SendMessageToAdmins(playerid, SOME_COLOUR, params);
return 1;
}
Simples
Re: [HELP] SendMessageToAdmins - Larsey123IsMe - 16.12.2010
:P thanks, and a Q about dcmd:
How to, like this :P
pawn Код:
dcmd_heal(playerid, params[])
{
new id;
if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \'/heal [ID]\'");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
SetPlayerHealth(id, 100.0);
//...
format(string, sizeof(string), "%s(%d) Healed you.",adminname ,playerid);
//...
format(string, sizeof(string), "You Healed %s(%d)",playername ,playerid);
}
return 1;
}