Command that sends message to admins online - 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)
+--- Thread: Command that sends message to admins online (
/showthread.php?tid=561107)
Command that sends message to admins online -
xX4m4zingXx - 01.02.2015
I want to create a command that sends a message to all admins online.
I want it to be like: /helpme How can I startup a vehicle?
and that the admin sees
((Playername Asks: How can I startup a vehicle?))
and I want that they are only able to send a helpme message again after the other one is already handled.
This is what I have so far.
pawn Код:
CMD:helpme(playerid, params[])
{
new
staff[MAX_PLAYER_NAME],
message[128]
;
if (sscanf(params, "s[128]", message)) return SendClientMessage(playerid, COL_GREY, "USAGE: /helpme [Question].");
format(message, 128, "((%s asks: %s))", GetName(playerid), message);
SendClientMessage(staff, COL_YELLOW, message);
return 1;
}
Re: Command that sends message to admins online -
HY - 01.02.2015
Make a stock to Send Message To Admins.
pawn Код:
stock SendMessageToAdmin(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(YourAdminVariable >= 1)
{
SendClientMessage(i, color, string);
}
}
}
}
Command:
pawn Код:
CMD:helpme(playerid, params[])
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
if(isnull(params)) return SendClientMessage(playerid, COL_GREY, "USAGE: /helpme [Question].");
if(!strlen(params)) return SendClientMessage(playerid, COL_GREY, "ERROR: You didn't writed anything.");
format(string, sizeof(string), "((%s asks: %s))", name, params);
SendMessageToAdmins(-1, string);
return 1;
}
Please, replace:
pawn Код:
if(YourAdminVariable >= 1)
From SendMessageToAdmin stock with your Admin variable. For example:
pawn Код:
if(PlayerInfo[i][pAdmin] >= 1)
Don't put in your variable "playerid", put "i".
Re: Command that sends message to admins online -
xX4m4zingXx - 01.02.2015
Thank you, that worked.
How can I make like a command that answers this questions?