/report help
#1

Hello, I tried to make a /report command using strcmp but I failed.
And I can't compile zcmd & sscanf in an FS for some reason.
Can anyone give me an strcmp /report command or an already-made zcmd & sscanf /report FS?
Thanks.
Reply
#2

You can't use strcmp & zcmd at the same time, you need to use one of them, however I suggest zcmd & sscanf.

pawn Код:
COMMAND:report(playerid, params[])
{
    new string[128], pID, reporter[MAX_PLAYER_NAME], reported[MAX_PLAYER_NAME];
    if(sscanf(params, "us[128]", pID, params[0])) return SendClientMessage(playerid, -1, "Usage: /report <playerid/playername> <reason>");
    if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "This player not connected");
    GetPlayerName(playerid, reporter, sizeof(reporter));
    GetPlayerName(pID, reported, sizeof(reported));
    format(string, sizeof(string), "%s reports %s for: %s",reporter, reported, params[2]);
    WhoToSend?Admins?(-1, string); // Edit this
    return 1;
}
Reply
#3

Do I need to put it in a filterscript? or in OnPlayerCommandText..?
Reply
#4

No, You can add it in gamemode. Don't add in any callback.
Reply
#5

Код:
(341) : warning 217: loose indentation
(477) : error 017: undefined symbol "SendMessageToAdmins"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
pawn Код:
SendMessageToAdmins(COLOR_YELLOW, string);
Reply
#6

pawn Код:
forward SendMessageToAdmins(color, const string[]);
public SendMessageToAdmins(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][your admin variable] >=1)
        {
            SendClientMessage(i, COLOR_YELLOW, string);
        }
    }
    return 1;
}
Now you can use that line
Reply
#7

Код:
(341) : warning 217: loose indentation
(486) : error 017: undefined symbol "PlayerInfo"
(486) : warning 215: expression has no effect
(486) : error 001: expected token: ";", but found "]"
(486) : error 029: invalid expression, assumed zero
(486) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Line 486 -
pawn Код:
if(PlayerInfo[i][Level] >=1)
By the way I'm using Xtreme Admin System.
Reply
#8

Bump.
Anyone?
Reply
#9

I dont know how xtreme admin works sorry, you can wait for someone who does
Reply
#10

pawn Код:
CMD:report(playerid, params[]) {
    if(sscanf(params, "s[128]", params)) {
        for(new i = 0; i < MAX_PLAYERS; ++i) {
            if(IsPlayerAdmin(i)) {
            new str[128], name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, MAX_PLAYER_NAME);
            format(str, sizeof(str), "Report from %s: %s", name, params);
            SendClientMessage(i, -1, str);
            }
        }
    }
    else return SendClientMessage(playerid, -1, "Syntax Error: /report [message]");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)