[HELP]Dcmd_Report -
Tessar - 12.12.2010
Hello,
I have tried to make a dcmd report command and have found out their are a few things wrong:
Код:
dcmd_report(playerid, params[])
{
new pName[24], string[128], pName2[24], reason[128],day, month, year;
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(playerid, pName2, sizeof(pName2));
if(!sscanf(params, "us", playerid, reason)) SendClientMessage(playerid, COLOR_RED, "Usage: /report [playerid] [reason]");
else {
format(string, sizeof(string),"%d/%d/%d: Report: %s [ID: %d] reported %s [ID: %d] for %s ",day, month, year, pName, playerid, pName2, playerid, reason);
SendmAdminMsg(COLOR_LIGHTRED, string);
SendClientMessage(playerid, COLOR_YELLOW, "Your report has been sent to the online admins");
}
return 1;
}
When i type /report id. It says everything except the reason.
When i then type /report id reason it says Usage: /report [playerid] [reason].
How would i also make it so the date is correct. it always says 0/0/0
Re: [HELP]Dcmd_Report -
Lorenc_ - 12.12.2010
Код:
GetPlayerName(pID, pName2, sizeof(pName2));
Код:
if(!sscanf(params, "us", pID, reason))
Код:
format(string, sizeof(string),"%d/%d/%d: Report: %s [ID: %d] reported %s [ID: %d] for %s ",day, month, year, pName, playerid, pName2, pID, reason);
Replace/Add the current ones... on your code. Might work.
Re: [HELP]Dcmd_Report -
Tessar - 12.12.2010
From doing this i get 2 errors:
Код:
Lvcnr.pwn(2595) : error 035: argument type mismatch (argument 1)
Lvcnr.pwn(2596) : error 035: argument type mismatch (argument 1)
This is the 2 lines which have the errors
Код:
GetPlayerName(pID, pName, sizeof(pName));
GetPlayerName(pID, pName2, sizeof(pName2));
Re: [HELP]Dcmd_Report -
Marcel - 12.12.2010
The code Lorenc_ gave was a bit wrong. He said you had to use
But this creates a string, but the GetPlayerName function requires an integer. So use
.
Re: [HELP]Dcmd_Report -
Tessar - 12.12.2010
It still doesn't work.
When i type /report id it works.
When i then type /report id reason it says USAGE: /report [id] [reason]
Re: [HELP]Dcmd_Report -
Marcel - 12.12.2010
I've rewritten your command with the newest sscanf. The plugin version which can be found on the forums as well.
pawn Код:
dcmd_report (playerid, params[])
{
new
pID,
pName[MAX_PLAYER_NAME],
string[230],
pName2[MAX_PLAYER_NAME],
reason[128],
day,
month,
year;
if (sscanf (params, "us[128]", pID, reason))
{
SendClientMessage (playerid, COLOR_RED, "Usage /report [playerid] [reason]");
}
else
{
if (!IsPlayerConnected (pID))
{
SendClientMessage (playerid, COLOR_RED, "This player is not connected!");
return 1;
}
GetPlayerName (playerid, pName, sizeof (pName));
GetPlayerName (pID, pName2, sizeof (pName2));
getdate (year, month, day);
format (string, sizeof (string), "%d/%d/%d: Report: %s [ID: %d] reported %s [ID: %d] for %s", day, month, year, pName, playerid, pName2, pID, reason);
SendmAdminMsg (COLOR_LIGHTRED, string);
SendClientMessage (playerid, COLOR_YELLOW, "Your report has been sent to the online admins!");
return 1;
}
return 1;
}
You have to use the sscanf plugin version! It is faster too!
Re: [HELP]Dcmd_Report -
Tessar - 12.12.2010
I still have the same problem when i try reporting myself.
Re: [HELP]Dcmd_Report -
Marcel - 12.12.2010
The command I gave you is working for me in my own gamemode! So I don't know where the problem is...