[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(playerid, params[])
{
    new 
pName[MAX_PLAYER_NAME], cName[MAX_PLAYER_NAME], cibleid, reason[128], string[128], string2[128];
    if(
sscanf(params, "is", cibleid, reason)) return SendClientMessage(playerid, 0xAA3333AA, "Usage: /report [id] [reason]");
    if(!
IsPlayerConnected(cibleid)) return SendClientMessage(playerid, 0xAA3333AA,"The Player is not connected");
    if(
cibleid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAA3333AA, "Invalid ID.");
    
//if(playerid == cibleid) return SendClientMessage(playerid, 0xAA3333AA, "You can't report yourself.");
    
GetPlayerName(playerid, pName, sizeof(pName));
    
GetPlayerName(cibleid, cName, sizeof(cName));
    
    
reporter[playerid] = cibleid;
    
    
SendClientMessage(playerid, 0xAA3333AA, "The report has been send to the admin online !");
    for (new 
i = 0; i < MAX_PLAYERS; i++)
    {
        if(
IsPlayerAdmin(i))
        {
            
format(string, sizeof(string), "The player : %s has been reported by : %s for : %s", cName, pName, reason);
            
SendClientMessageToAll(0xAA3333AA, string);
            
format(string2, sizeof(string2), "You want to accept the report do /ar , you want to denied the report do /rd");
            
SendClientMessageToAll(0xAA3333AA, string2);
        }
        return 
1;
    }
    return 
1;
}
//Command /ar
CMD:ar(playerid, params[])
{
    new 
giveplayerid, playername[64], giveplayer[64], string[120];
    if(!
IsPlayerAdmin(playerid)) return 0;
    if (
sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /ar [playerid]");
    new 
giveplayerid1 = reporter[giveplayerid];
    
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    
GetPlayerName(giveplayerid1, giveplayer, MAX_PLAYER_NAME);
    if(
giveplayerid1 == -1) return SendClientMessage(playerid, COLOR_RED, "Error: That player did not report anyone now!");
    if(!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: User not online!");
    if(!
IsPlayerConnected(giveplayerid1)) return SendClientMessage(playerid, COLOR_RED, "Error: User not online!");
    
format(string, sizeof(string), "Your report on %s(%d) has been reviewed by %s(%d)", giveplayer, giveplayerid, playername, playerid);
    
SendClientMessage(giveplayerid, 0x009900FF, string);
    return 
1;
}
//Command /dr
CMD:dr(playerid, params[])
{
    new 
giveplayerid, playername[64], giveplayer[64],reason[50], string[120];
     if(!
IsPlayerAdmin(playerid)) return 0;
    if (
sscanf(params, "us[128]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /dr [playerid] [reason]");
    new 
giveplayerid1 = reporter[giveplayerid];
    
GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
    
GetPlayerName(giveplayerid1, giveplayer, MAX_PLAYER_NAME);
    if(
giveplayerid1 == -1) return SendClientMessage(playerid, COLOR_RED, "Error: That player did not report anyone now!");
    if(!
IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_RED, "Error: User not online!");
    if(!
IsPlayerConnected(giveplayerid1)) return SendClientMessage(playerid, COLOR_RED, "Error: User not online!");
    
format(string, sizeof(string), "Your report on %s(%d) has been declined by %s(%d), reason: %s", giveplayer, giveplayerid1, playername, playerid, reason);
    
SendClientMessage(giveplayerid, COLOR_RED, string);
    
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)