Report System - 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: Report System (
/showthread.php?tid=300790)
Report System -
Shockey HD - 01.12.2011
Howdy, So im working on a report system so that one they do /report [Text]
It send's the message to Admins Only.
The only problem is that i do not know how i would make it sent to Admins Only.
Here is the /report Command so Far.
pawn Код:
CMD:report(playerid,params[])
{
new text,pName[MAX_PLAYER_NAME],string[128];
if(sscanf(params, "s[125]", text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /report [Text]");
else
{
PlayerInfo[playerid][pReportSent] = 1;
SendClientMessage(playerid,COLOR_YELLOW,"Your Report Has Been Sent Succesfully...");
GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
format(string,128,"%s:[%d]:%s",pName,playerid,text);
SendClientMessage(playerid,COLOR_ORANGE,string);
}
return 1;
}
Re: Report System -
grand.Theft.Otto - 01.12.2011
You have to make a separate function, like MessageToAdmins. Here:
pawn Код:
forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
if(IsPlayerAdmin(i))
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
Then, when you format the message, use MessageToAdmins(COLOR_HERE,string); instead of SendClientMessage(...);
You can change IsPlayerAdmin to your admin variables if you have any.
Re: Report System -
JohnD123 - 12.04.2014
Quote:
Originally Posted by grand.Theft.Otto
You have to make a separate function, like MessageToAdmins. Here:
pawn Код:
forward MessageToAdmins(color,const string[]); public MessageToAdmins(color,const string[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i) == 1) { if(IsPlayerAdmin(i)) { SendClientMessage(i, color, string); } } } return 1; }
Then, when you format the message, use MessageToAdmins(COLOR_HERE,string); instead of SendClientMessage(...);
You can change IsPlayerAdmin to your admin variables if you have any.
|
Thanks for this public funcion
, rep+
Re: Report System -
Hanuman - 12.04.2014
Quote:
Originally Posted by JohnD123
Thanks for this public funcion , rep+
|
Bumping 2 year old topic, Hmm nice, i like it.
Re: Report System -
RajatPawar - 12.04.2014
Quote:
Originally Posted by Hanuman
Bumping 2 year old topic, Hmm nice, i like it.
|
Better than creating a new one, though!
Quote:
Originally Posted by JohnD123
Thanks for this public funcion , rep+
|
Might I suggest a
minor improvement? Remove IsPlayerConnected because IsPlayerAdmin will always return 0 if the player's not connected.