Creating report command?
#1

Hi i want to have a dcmd_report command , so the report will send to all online admins ,
i'm using : AdminLevel[Playerid]

have you any idea how to make it ? + i want explication of all lines thank you .
Reply
#2

you are using sscanf?
Reply
#3

pawn Код:
command(report, playerid, params[]) {
    new report[128], name[24];
    if(sscanf(params, "s[128]", report)) return SendClientMessage(playerid, -1, "/report [reason]");
    GetPlayerName(playerid, name, 24);

    format(report, sizeof(report), "%s report's %s", name, report);
    for(new i = 0; i != MAX_PLAYERS; ++i)  {
        if(AdminLevel[i] > 0) {
           SendClientMessage(i, -1, report);
        }
    }
    return 1;
}
Just transform into dcmd!
Reply
#4

Not work it doesn't show the report text
Reply
#5

pawn Код:
command(report, playerid, params[]) {
    new report[128], name[24];
    if(sscanf(params, "s[128]", report)) return SendClientMessage(playerid, -1, "/report [reason]");
    GetPlayerName(playerid, name, 24);

    format(report, sizeof(report), "%s report's %s", name, report);
    for(new i = 0; i != MAX_PLAYERS; ++i)  {
        if(AdminLevel[i] > 0) return SendClientMessage(i, -1, report);
    }
    return 1;
}
Reply
#6

try this
pawn Код:
dcmd_report(playerid, params[]) // i don't use dcmd, idk about this line
{
    new s_text[128], s_string[128], ID, pname[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", ID, s_text)) return SendClientMessage(playerid, -1, "Usage: /report [playerid] [reason]");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Invalid ID!");
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName(ID, aname, sizeof(aname));
    format(s_string, sizeof(s_string), "%s(%d) has reported %s(%d) Reason: %s", pname, playerid, aname, ID, s_text);
    for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
    {
        if(IsPlayerAdmin(playerid) || AdminLevel[playerid] >= 1)
        {
            SendClientMessage(playerid, Color, s_string);
        }
    }
    SendClientMessage(playerid, -1, "Your report has been sent to the current admins. The report will be checked. Thank you.");
    return 1;
}
Reply
#7

Its a Very Basic Command

Basically You'll Need to Check if Player is Administrator or Not.
I'm Not Sure how you Program but my 'C++ Way' Would be Somthing as Follows
Using Pvars/Gvars May be a Possiblity.
Код:
if (AdminLevel == 1)
{
//Show the (/Report)
};
Then Just Create a Basic D_CMD (/Report) Function
I Myself, Dont Use That;

Cheers;
Ricey
Reply
#8

Quote:
Originally Posted by Ricey
Посмотреть сообщение
Its a Very Basic Command

Basically You'll Need to Check if Player is Administrator or Not.
I'm Not Sure how you Program but my 'C++ Way' Would be Somthing as Follows
Using Pvars/Gvars May be a Possiblity.
Код:
if (AdminLevel == 1)
{
//Show the (/Report)
};
Then Just Create a Basic D_CMD (/Report) Function
I Myself, Dont Use That;

Cheers;
Ricey
this,

AdminLevel of who?
You need to define what admin level, in this case player "i" which is also defined as "all players that are online"
Reply
#9

Sorry, That was a Very Quick Post.

Somthing that may be more Correct

if(AdminLevel[i] > 0) or if(AdminLevel[i] == 1)//If Thats the Equal to Level so if it is Exactly Level 1.
{
//Program
};
Reply
#10

But since its just one lil message you can also use:

pawn Код:
if(AdminLevel[i] > 0) return SendClientMessage(i, COLOR, report);

No extra brackets needed then
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)