Need a /reports command
#1

I need a /reports command which shows the last 10 reports in a dialog box including "Plaer" "Reported by" "Reason" - these three must be the headings.
I'll give one of my admin commands

pawn Код:
COMMAND:jail(playerid, params[])
{
    if(playerData[playerid][playerLoggedIn])
    {
        if(playerData[playerid][playerLevel] >= 1)
        {
            // Set-up our variables etc
            new PlayerToJail, JailTime, Reason[128], Msg[328], Name[24], jailedBy[24], MsgAll[328];
 
            if (sscanf(params, "uis[128]", PlayerToJail, JailTime, Reason))
            {
                // Incorrect params used
                SendClientMessage(playerid, COLOR_ORANGE, "Usage: \"jail <PlayerToJail> <JailTime> <Reason>\"");
            }
            else
            {
                if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
                {
                    if(playerData[PlayerToJail][playerLoggedIn])
                    {
                        if(playerData[playerid][playerLevel] >= playerData[PlayerToJail][playerLevel])
                        {
                            if(JailTime >= 1)
                            {
                                // Get the name of the player who jailed the player
                                GetPlayerName(playerid, jailedBy, sizeof(jailedBy));
                               
                                // Get the name of the player who's being sent to jail
                                GetPlayerName(PlayerToJail, Name, sizeof(Name));
 
                                for(new p; p < MAX_PLAYERS; p++)
                                {
                                    new pName[24];
                                    GetPlayerName(p, pName, sizeof(pName));
       
                                    if(!strcmp(pName, Name))
                                    {
                                        // Send the jailed player a message who jailed him, why he's been jailed and how long
                                        format(Msg, sizeof(Msg), "{A9C4E4}An administrator has jailed you for %i seconds {FE9A2E}[REASON: %s]{FFFFFF}", JailTime, Reason);
                                        SendClientMessage(p, COLOR_WHITE, Msg);
                                    }
                                    else
                                    {
                                        format(MsgAll, sizeof(MsgAll), "{A9C4E4}An administrator has sent %s(%i) to jail.", Name, PlayerToJail);
                                        SendClientMessage(p, COLOR_WHITE, MsgAll);
                                    }
                                }
                               
                                new aMsg[300];
                                for (new i=0; i<MAX_PLAYERS; i++)
                                {
                                    if (playerData[i][playerLevel] >= 1)
                                    {
                                        format(aMsg, sizeof(aMsg), "{FF0770}[ADMIN] {FFFFFF}%s(%i) has jailed %s(%i) for %i seconds {FE9A2E}[REASON: %s]{FFFFFF}", playerData[playerid][playerNamee], playerid, playerData[PlayerToJail][playerNamee], PlayerToJail, JailTime, Reason);
                                        SendClientMessage(i, COLOR_WHITE, aMsg);
                                    }
                                }      
 
                                // Call jail function
                                sendPlayerJail(PlayerToJail, JailTime, playerid, 0);
                                playerData[PlayerToJail][playerAdminJailed] = 1;
                               
                                ShowPlayerDialog(PlayerToJail, 91827, DIALOG_STYLE_MSGBOX, "Admin Jailed", "You have been sent to jail by an administrator.", "OK", "");
                               
                                new log[250];
                                format(log, sizeof(log), "%s(%i) has jailed %s(%i) for %i seconds", playerData[playerid][tempAdminName], playerid, Name, PlayerToJail, JailTime);
                                SendAdminText(playerid, log);
                            }
                            else
                            {
                                SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You cannot use this command on that player.");
                            }
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}Jail time must be at least 1 second.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not logged in!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}That player is not online!");
                }
            }
        }
        else
        {
            return 0;
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
    }
 
    return 1;
}
Btw only admin level 1+ should be able to use /reports
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=447813
Reply
#3

Instead of posting a request on scripting help section, you could post it as TheToretto linked.

But if nobody helped you, you could try to download a gamemode (I suggested roleplay gamemode), then copy-paste its report system and learn from it. If you're already knowledged enough about report system, then re-code a report system by your way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)