/report Command
#1

How Would I Make One Using DCMD?

My Admin Variable Is

Код:
PlayerInfo[playerid][pAdminLevel]
Thanks

Ellie

P.S Im new to DCMD Commands :l
Reply
#2

pawn Код:
dcmd_report(playerid, params[])
{
    new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], str[128], reason, iD;
    if (sscanf(params, "dz", iD, reason)) return SendClientMessage(playerid, 0xAA3333AA, "Usage: /report [id] [reason]");
    if (iD == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAA3333AA, "Invalid ID.");
    if (playerid == iD) return SendClientMessage(playerid, 0xAA3333AA, "You can't report yourself.");
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(iD, aName, sizeof(aName));
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            new zName[MAX_PLAYER_NAME], pFile[256];
            GetPlayerName(i, zName, sizeof(zName));
            format(pFile, sizeof(pFile), "Users\%s.ini", zName);
            if (IsPlayerAdmin(i) || dini_Int(pFile, "AdminLevel") >= 1)
            {
                format(str, sizeof(str), "%s(%d) has reported %s(%d) for: %s", pName, playerid, aName, iD, reason);
                SendClientMessage(i, 0xFFFFFFFF, str);
            }
        }
    }
    return 1;
}
from https://sampforum.blast.hk/showthread.php?tid=217479
just change the variables. its easy
Reply
#3

I suggest using ycommands is very fast.

https://sampforum.blast.hk/showthread.php?tid=169029
Reply
#4

Quote:
Originally Posted by |_ⒾⓇⓄN_ⒹⓄG_|
Посмотреть сообщение
pawn Код:
dcmd_report(playerid, params[])
{
    new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], str[128], reason, iD;
    if (sscanf(params, "dz", iD, reason)) return SendClientMessage(playerid, 0xAA3333AA, "Usage: /report [id] [reason]");
    if (iD == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAA3333AA, "Invalid ID.");
    if (playerid == iD) return SendClientMessage(playerid, 0xAA3333AA, "You can't report yourself.");
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(iD, aName, sizeof(aName));
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            new zName[MAX_PLAYER_NAME], pFile[256];
            GetPlayerName(i, zName, sizeof(zName));
            format(pFile, sizeof(pFile), "Users\%s.ini", zName);
            if (IsPlayerAdmin(i) || dini_Int(pFile, "AdminLevel") >= 1)
            {
                format(str, sizeof(str), "%s(%d) has reported %s(%d) for: %s", pName, playerid, aName, iD, reason);
                SendClientMessage(i, 0xFFFFFFFF, str);
            }
        }
    }
    return 1;
}
from https://sampforum.blast.hk/showthread.php?tid=217479
just change the variables. its easy
I Did that and it doesn't work and in the CMD Box i get these warnings?



Help

Ellie
Reply
#5

well sscanf changed a bit, change the 'z' to 'S'
it must fix some of that messages.
i didn't understood the length part.... i think u have to do something like [20].
Reply
#6

Quote:
Originally Posted by |_ⒾⓇⓄN_ⒹⓄG_|
Посмотреть сообщение
well sscanf changed a bit, change the 'z' to 'S'
it must fix some of that messages.
i didn't understood the length part.... i think u have to do something like [20].
I'll try later going to sleep now and what do u mean by do something like [20]?

Ellie
Reply
#7

Bump
Reply
#8

pawn Код:
if (sscanf(params, "ds[128]", iD, reason))
Reply
#9

Quote:
Originally Posted by =WoR=Varth
Посмотреть сообщение
pawn Код:
if (sscanf(params, "ds[128]", iD, reason))
Thanks <3

Ellie
Reply
#10

Oh theirs just one more problem

when the player sends the report if his adminlevel isn't set to 1 he can still see text "%s(%d) has reported %s(%d) for: %s"

Код:
dcmd_complain(playerid, params[])
{
    new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME], str[128], reason, iD;
    if (sscanf(params, "ds[128]", iD, reason)) return SendClientMessage(playerid, 0xAA3333AA, "Usage: /complain [id] [reason]");
    if (playerid == iD) return SendClientMessage(playerid, 0xAA3333AA, "You can't report yourself.");
	GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(iD, aName, sizeof(aName));
	if (iD == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xAA3333AA, "Invalid ID.");
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            new name[MAX_PLAYER_NAME], file[256];
    		GetPlayerName(playerid, name, sizeof(name));
    		format(file, sizeof(file), SERVER_USER_FILE, name);
            if (dini_Int(file, "AdminLevel") >= 1)
            {
                format(str, sizeof(str), "%s(%d) has reported %s(%d) for: %s", pName, playerid, aName, iD, reason);
                SendClientMessage(i, 0xFFFFFFFF, str);
            }
        }
    }
    return 1;
}
Ellie
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)