/report Command -
Ely - 26.10.2011
How Would I Make One Using DCMD?
My Admin Variable Is
Код:
PlayerInfo[playerid][pAdminLevel]
Thanks
Ellie
P.S Im new to DCMD Commands :l
Re: /report Command -
|_ⒾⓇⓄN_ⒹⓄG_| - 26.10.2011
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
Re: /report Command -
TheBluec0de - 26.10.2011
I suggest using ycommands is very fast.
https://sampforum.blast.hk/showthread.php?tid=169029
Re: /report Command -
Ely - 26.10.2011
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
Re: /report Command -
|_ⒾⓇⓄN_ⒹⓄG_| - 26.10.2011
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].
Re: /report Command -
Ely - 26.10.2011
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
Re: /report Command -
Ely - 27.10.2011
Bump
Re: /report Command -
=WoR=Varth - 27.10.2011
pawn Код:
if (sscanf(params, "ds[128]", iD, reason))
Re: /report Command -
Ely - 27.10.2011
Quote:
Originally Posted by =WoR=Varth
pawn Код:
if (sscanf(params, "ds[128]", iD, reason))
|
Thanks <3
Ellie
Re: /report Command -
Ely - 27.10.2011
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