Report Command
#1

Hello,
I'm having a problem with this command, I know it's simple enough to understand but i can't find the problem here
It keeps spamming the 'USAGE' text.
PHP код:
CMD:report(playeridparams[])
{
    new 
id;
    new 
reason[50];
    
/*keeps spamming this ==>*/if(sscanf(params"us[50]"idreason)) return SendClientMessage(playerid, -1"Usage: /report [id] [reason]");
    if(
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"ERROR: Player is not connected!");
    new 
sender[MAX_PLAYER_NAME], reported[MAX_PLAYER_NAME], string[128];
    
GetPlayerName(playeridsendersizeof(sender));
    
GetPlayerName(idreportedsizeof(reported));
    
format(stringsizeof(string), "ADMIN CONSOLE - Player %s(%d) has reported player %s(%d)"senderplayeridreportedid);
    
SendMessageToAdmins(string);
    
format(stringsizeof(string), "ADMIN CONSOLE - Reason: %s"reason);
    
SendMessageToAdmins(string);
    
format(stringsizeof(string), "ADMIN CONSOLE - Use '/approve %d' to approve this player's report"playerid);
    
SendMessageToAdmins(string);
    
SendClientMessage(playeridCOLOR_RED"Your report has been recieved, Wait for it's approval");
    
reportid[playerid]=1;
    return 
1;

Reply
#2

Код:
COMMAND:report(playerid, params[])
{
    new id, reason[50], string[128];
    if(sscanf(params, "is[50]", id, reason))
		return SendClientMessage(playerid, -1, "Usage: /report [id] [reason]");
		
    if(id == INVALID_PLAYER_ID)
		return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!");
		
	if (reason > 49)
	    return SendClientMessage(playerid, COLOR_RED, "error");
		
    new sender[24], reported[24];
    GetPlayerName(playerid, sender, sizeof(sender));
    GetPlayerName(id, reported, sizeof(reported));
    
    format(string, sizeof(string), "ADMIN CONSOLE - Player %s(%d) has reported player %s(%d)", sender, playerid, reported, id);
    SendMessageToAdmins(string);
    
    format(string, sizeof(string), "ADMIN CONSOLE - Reason: %s", reason);
    SendMessageToAdmins(string);
    
    format(string, sizeof(string), "ADMIN CONSOLE - Use '/approve %d' to approve this player's report", playerid);
    SendMessageToAdmins(string);
    
    SendClientMessage(playerid, COLOR_RED, "Your report has been recieved, Wait for it's approval");
    reportid[playerid] = 1;
    return 1;
}
Reply
#3

Wrong Code @Freedom, "U" is for playerid, "i" is for integer..

try this..
PHP код:
CMD:report(playeridparams[])
{
    new 
id;
    if(
sscanf(params"us[50]"idparams)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /report [id] [reason]");
    if(
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"ERROR: Player is not connected!");
    new 
sender[MAX_PLAYER_NAME], reported[MAX_PLAYER_NAME], string[128];
    
GetPlayerName(playeridsendersizeof(sender));
    
GetPlayerName(idreportedsizeof(reported));
    
format(stringsizeof(string), "ADMIN CONSOLE - Player %s(%d) has reported player %s(%d)"senderplayeridreportedid);
    
SendMessageToAdmins(string);
    
format(stringsizeof(string), "ADMIN CONSOLE - Reason: %s"params);
    
SendMessageToAdmins(string);
    
format(stringsizeof(string), "ADMIN CONSOLE - Use '/approve %d' to approve this player's report"playerid);
    
SendMessageToAdmins(string);
    
SendClientMessage(playeridCOLOR_RED"Your report has been recieved, Wait for it's approval");
    
reportid[playerid]=1;
    return 
1;

Reply
#4

Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
Wrong Code @Freedom, "U" is for playerid, "i" is for integer..
Does it matter? Playerid is already integer. You should think twice before say anything like that.
Reply
#5

Quote:
Originally Posted by Freedom.
Посмотреть сообщение
Does it matter? Playerid is already integer. You should think twice before say anything like that.
It does, as U allows them to both type in the playerid and the player's name. R is even better since it excludes NPCs. You should think twice before saying anything like that.
Reply
#6

Quote:
Originally Posted by DTV
Посмотреть сообщение
It does, as U allows them to both type in the playerid and the player's name. R is even better since it excludes NPCs. You should think twice before saying anything like that.
Who writes player name instead of id for report? It is waste of time. Thanks for info for R actually I never use NPC so I did not think before.
Reply
#7

Quote:
Originally Posted by Freedom.
Посмотреть сообщение
Who writes player name instead of id for report? It is waste of time. Thanks for info for R actually I never use NPC so I did not think before.
Some people might, you gotta accommodate for everyone otherwise someone will complain :P
Reply
#8

Quote:
Originally Posted by Freedom.
Посмотреть сообщение
Who writes player name instead of id for report? It is waste of time. Thanks for info for R actually I never use NPC so I did not think before.
I do writes their name instead of ID (sometimes).
Reply
#9

Quote:
Originally Posted by Freedom.
Посмотреть сообщение
Who writes player name instead of id for report? It is waste of time.
when you play at large servers i.e. rc-rp or LS-RP, you're not gonna know the ID of most people. instead of having to scroll through a 100+ player list, typing the name saves time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)