[HELP] Report commands [SOLVED]
#1

Hello, I need help with the report command

pawn Код:
dcmd_report(playerid, text[]) {
  if(!strlen(text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [id] [reason]");
  else{
      new string[ 256 ], playername[ MAX_PLAYER_NAME ], playername2[MAX_PLAYER_NAME];
      GetPlayerName(playerid, playername, sizeof(playername));
      GetPlayerName(playerid,playername2,sizeof(playername));
    format(string, sizeof(string), "%s(%d) reported %s(%d) Reason: %s", playername, playerid, playername2, playerid, text);
    add_Reportlog( string );
    SendAdminMessage(COLOR_RED, string);
    SendClientMessage(playerid, COLOR_GREEN, "[Succeeded] Report sent to currently online admins.");
  }
  return 1;
}
Everything works except, when I use /report 0 BlaBlaBla (when I report myself), it gives this income to admins; Player1(0) reported Player1(0) Reason: 0 BlaBlaBla

How can I remove that 0 before the text??

Also can anyone add if player id is not valid to send client message "Invalid ID" or something,
Thanks.
Reply
#2

Anybody knows where is the problem?
Please
Reply
#3

If you type the users name not ID it'll Format like: "Reason: Name BlaBlaBla" am i right?

Reply
#4

Yes, you are right... And whatever ID or name I use it always reports ID 0 ... O.o

Can anyone make /report command working with similar parameters like above...
All I need is when player uses /report ID reason, if ID is not valid gives player outcome "Invalid ID", or if it's valid gives player outcome "[Succeeded] Report sent to currently online admins.", and to admins gives outcome Player1(id) reported Player2(id) Reason: Reason1
Reply
#5

Код:
dcmd_report(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] != 1) return SendClientMessage(playerid, COLOR_RED, "You must be loged in");

	new tmp[256], tmp2[256], Index;
	tmp = strtok(params,Index), tmp2 = strtok(params,Index);

	new kohde;
	kohde = strval(tmp);

	if(!strlen(tmp)) return SendClientMessage(playerid, 0xB4B4B4FF, "Use: /report [ID] [reason]");
	if(!strlen(tmp2)) return SendClientMessage(playerid, 0xB4B4B4FF, "Use: /report [ID] [reason]");
	if(!IsPlayerConnected(kohde)) SendClientMessage(playerid, 0xB4B4B4FF, "Wrong ID");
	if(playerid == kohde) return SendClientMessage(playerid, 0xB4B4B4FF, "You cant report yourself -.-");

	new string[128];

	format(string, sizeof(string), "New report %s(%d) has reported %s(%d), reason: %s", PlayerName(playerid), playerid, PlayerName(kohde), kohde, params[2]);
	SendMessageToAdmins(0xFF0000FF, string);

	SendClientMessage(playerid, 0xB4B4B4FF, "Your report is sended to online admins");

	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);

	return 1;
}
try this
Reply
#6

Got this error when try to compile...

Код:
error 017: undefined symbol "PlayerName"
Reply
#7

pawn Код:
stock PlayerName(playerid) {
 new name[24];
 GetPlayerName(playerid, name, 24);
 return name;
}
Just add this to bottom of your script.
Reply
#8

Thanks, it's working.... solved
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)