[FIX]: Report command
#1

Hi!

I have another question...

Is this code OK?

CODE:

PHP код:
COMMAND:report(playerid,params[]) {
    new
        
name1[30],
        
name2[30],
        
id,
        
text[128],
        
reason[50];
    if(
sscanf(params,"us",id,reason))
        return 
SendClientMessage(playeridCOLOR_RED,"Usage: /report [id] [reason]");
    if(
IsPlayerConnected(id)) {
        
SendClientMessage(playerid,COLOR_GREEN,"Thanks for reporting. Your report have been sent to online administartor.");
        for(new 
0MAX_PLAYERS; ++i) {
            if(
gPlayerInfo[playerid][PLAYER_LEVEL] < 1)
            {
            
GetPlayerName(playerid,name1,sizeof(name1));
            
GetPlayerName(id,name2,sizeof(name2));
            new 
Hour,Minute,Second;
            
gettime(Hour,Minute,Second);
            
format(text,sizeof(text),"|| %d:%d:%d || [Report] | \"%s\" [%i] has reported \"%s\" [%i], reason: %s.",Hour,Minute,Second,name1,playerid,name2,id,reason);
            
SendClientMessage(i,COLOR_YELLOW,text);
            
ReportLog(text);
        }
        }
    } else {
        return 
SendClientMessage(playerid,COLOR_RED,"ERROR: This player is not connected.");
    }
    return 
1;

I get no ERRORS and ingame everything works, only admins don't get report.
Reply
#2

pawn Код:
if(gPlayerInfo[playerid][PLAYER_LEVEL] < 1)
Adjust < 1 to >= 1, and playerid to i
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)