[REP]Repport command help
#1

see the post it's finish
Reply
#2

Take an example

PHP код:
//On Top of script
reporter[MAX_PLAYERS];
//OnPlayerConnect And OnPlayerDisconnect
reporter[playerid] = -1;
//Command Report
CMD:report(playeridparams[])
{
    new 
pName[MAX_PLAYER_NAME], cName[MAX_PLAYER_NAME], cibleidreason[128], string[128], string2[128];
    if(
sscanf(params"is"cibleidreason)) return SendClientMessage(playerid0xAA3333AA"Usage: /report [id] [reason]");
    if(!
IsPlayerConnected(cibleid)) return SendClientMessage(playerid0xAA3333AA,"The Player is not connected");
    if(
cibleid == INVALID_PLAYER_ID) return SendClientMessage(playerid0xAA3333AA"Invalid ID.");
    
//if(playerid == cibleid) return SendClientMessage(playerid, 0xAA3333AA, "You can't report yourself.");
    
GetPlayerName(playeridpNamesizeof(pName));
    
GetPlayerName(cibleidcNamesizeof(cName));
    
    
reporter[playerid] = cibleid;
    
    
SendClientMessage(playerid0xAA3333AA"The report has been send to the admin online !");
    for (new 
0MAX_PLAYERSi++)
    {
        if(
IsPlayerAdmin(i))
        {
            
format(stringsizeof(string), "The player : %s has been reported by : %s for : %s"cNamepNamereason);
            
SendClientMessageToAll(0xAA3333AAstring);
            
format(string2sizeof(string2), "You want to accept the report do /ar , you want to denied the report do /rd");
            
SendClientMessageToAll(0xAA3333AAstring2);
        }
        return 
1;
    }
    return 
1;
}
//Command /ar
CMD:ar(playeridparams[])
{
    new 
giveplayeridplayername[64], giveplayer[64], string[120];
    if(!
IsPlayerAdmin(playerid)) return 0;
    if (
sscanf(params"u"giveplayerid)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /ar [playerid]");
    new 
giveplayerid1 reporter[giveplayerid];
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
GetPlayerName(giveplayerid1giveplayerMAX_PLAYER_NAME);
    if(
giveplayerid1 == -1) return SendClientMessage(playeridCOLOR_RED"Error: That player did not report anyone now!");
    if(!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: User not online!");
    if(!
IsPlayerConnected(giveplayerid1)) return SendClientMessage(playeridCOLOR_RED"Error: User not online!");
    
format(stringsizeof(string), "Your report on %s(%d) has been reviewed by %s(%d)"giveplayergiveplayeridplayernameplayerid);
    
SendClientMessage(giveplayerid0x009900FFstring);
    return 
1;
}
//Command /dr
CMD:dr(playeridparams[])
{
    new 
giveplayeridplayername[64], giveplayer[64],reason[50], string[120];
     if(!
IsPlayerAdmin(playerid)) return 0;
    if (
sscanf(params"us[128]"giveplayeridreason)) return SendClientMessage(playeridCOLOR_WHITE"Usage: /dr [playerid] [reason]");
    new 
giveplayerid1 reporter[giveplayerid];
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
GetPlayerName(giveplayerid1giveplayerMAX_PLAYER_NAME);
    if(
giveplayerid1 == -1) return SendClientMessage(playeridCOLOR_RED"Error: That player did not report anyone now!");
    if(!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playeridCOLOR_RED"Error: User not online!");
    if(!
IsPlayerConnected(giveplayerid1)) return SendClientMessage(playeridCOLOR_RED"Error: User not online!");
    
format(stringsizeof(string), "Your report on %s(%d) has been declined by %s(%d), reason: %s"giveplayergiveplayerid1playernameplayeridreason);
    
SendClientMessage(giveplayeridCOLOR_REDstring);
    
reporter[giveplayerid] = -1;
    return 
1;

Reply
#3

Thank you +rep
Reply
#4

There is a string without lenght in CMD:report that will show you some errors in the server log
"string without size and destination" as i remember
Код:
if(sscanf(params, "is", cibleid, reason)) return SendClientMessage(playerid, 0xAA3333AA, "Usage: /report [id] [reason]");
change to
Код:
if(sscanf(params, "is[128]", cibleid, reason)) return SendClientMessage(playerid, 0xAA3333AA, "Usage: /report [id] [reason]");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)