CMD:cr(playerid, params[]) { if(pInfo[playerid][AdminLevel] > 0) { new otherid, aName[MAX_PLAYER_NAME], string[256], othername[MAX_PLAYER_NAME], string2[256], string3[256]; GetPlayerName(playerid, aName, sizeof(aName)); GetPlayerName(otherid, othername, sizeof(othername)); if(sscanf(params, "r", otherid)) return SendClientMessage(playerid, COLOR_GREY, "Usage: {FFFFFF}/cr [playerid/name] + [reason]"); { if(otherid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "That player is not connected."); if(pInfo[otherid][HasReport] == 0) return SendClientMessage(playerid, COLOR_GREY, "That player does not have any reports available."); format(string, sizeof(string), "* Admin %s has closed the report from %s [%d, level %d]: %s", aName, othername, otherid, pInfo[otherid][Level], pInfo[otherid][Report]); submitToHelpersAndAdmins(string, COLOR_HOTORANGE); format(string2, sizeof(string2), "> Admin %s: %s", aName, params); submitToHelpersAndAdmins(string, COLOR_YELLOW); SendClientMessage(playerid, -1, "Your report has been closed."); pInfo[otherid][HasReport] = 0; pInfo[otherid][ReportAccepted] = 0; } if(sscanf(params, "rs", otherid, params)) return SendClientMessage(playerid, COLOR_GREY, "Usage: {FFFFFF}/cr [playerid/name] + [reason]"); { format(string2, sizeof(string2), "> Admin %s: %s", aName, params); submitToHelpersAndAdmins(string2, COLOR_YELLOW); format(string3, sizeof(string3), "Admin %s: %s", aName, params); SendClientMessage(otherid, -1, string3); SendClientMessage(playerid, -1, "Your report has been closed."); pInfo[otherid][HasReport] = 0; pInfo[otherid][ReportAccepted] = 0; } } else return SendClientMessage(playerid, -1, NotAdmin); return 1; }
CMD:cr(playerid, params[])
{
if(pInfo[playerid][AdminLevel] > 0)
{
new otherid, aName[MAX_PLAYER_NAME], string[256], othername[MAX_PLAYER_NAME], string2[256], string3[256];
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerName(otherid, othername, sizeof(othername));
if(sscanf(params, "u", otherid)) return SendClientMessage(playerid, COLOR_GREY, "Usage: {FFFFFF}/cr [playerid/name] + [reason]");
{
if(otherid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");
if(pInfo[otherid][HasReport] == 0) return SendClientMessage(playerid, COLOR_GREY, "That player does not have any reports available.");
format(string, sizeof(string), "* Admin %s has closed the report from %s [%d, level %d]: %s", aName, othername, otherid, pInfo[otherid][Level], pInfo[otherid][Report]);
submitToHelpersAndAdmins(string, COLOR_HOTORANGE);
format(string2, sizeof(string2), "> Admin %s: %s", aName, params);
submitToHelpersAndAdmins(string, COLOR_YELLOW);
SendClientMessage(playerid, -1, "Your report has been closed.");
pInfo[otherid][HasReport] = 0;
pInfo[otherid][ReportAccepted] = 0;
}
if(sscanf(params, "rs", otherid, params)) return SendClientMessage(playerid, COLOR_GREY, "Usage: {FFFFFF}/cr [playerid/name] + [reason]");
{
format(string2, sizeof(string2), "> Admin %s: %s", aName, params);
submitToHelpersAndAdmins(string2, COLOR_YELLOW);
format(string3, sizeof(string3), "Admin %s: %s", aName, params);
SendClientMessage(otherid, -1, string3);
SendClientMessage(playerid, -1, "Your report has been closed.");
pInfo[otherid][HasReport] = 0;
pInfo[otherid][ReportAccepted] = 0;
}
}
else return SendClientMessage(playerid, -1, NotAdmin);
return 1;
}
If didn't work, explain me whats wrong with it.
Make a new string called "reason" for example, and use "rs" only, then check if reason string is empty, if it is, it means only player id/name was entered.
|
CMD:cr(playerid, params[])
{
if(pInfo[playerid][AdminLevel] > 0)
{
new otherid, aName[MAX_PLAYER_NAME], string[256], othername[MAX_PLAYER_NAME], reason[256];
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerName(otherid, othername, sizeof(othername));
if(sscanf(params, "u", otherid)) return SendClientMessage(playerid, COLOR_GREY, "Usage: {FFFFFF}/cr [playerid/name] + [reason]");
if(otherid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "That player is not connected.");
if(pInfo[otherid][HasReport] == 0) return SendClientMessage(playerid, COLOR_GREY, "That player does not have any reports available.");
if (sscanf(params, "us", otherid, reason))
{
format(string, sizeof(string), "* Admin %s has closed the report from %s [%d, level %d]: %s", aName, othername, otherid, pInfo[otherid][Level], pInfo[otherid][Report]);
submitToHelpersAndAdmins(string, COLOR_HOTORANGE);
format(string, sizeof(string), "> Admin %s: %s", aName, params);
submitToHelpersAndAdmins(string, COLOR_YELLOW);
SendClientMessage(playerid, -1, "Your report has been closed.");
}
else
{
format(string, sizeof(string), "> Admin %s: %s", aName, params);
submitToHelpersAndAdmins(string, COLOR_YELLOW);
format(string, sizeof(string), "Admin %s: %s", aName, params);
SendClientMessage(otherid, -1, string);
SendClientMessage(playerid, -1, "Your report has been closed.");
}
pInfo[otherid][HasReport] = 0;
pInfo[otherid][ReportAccepted] = 0;
}
else return SendClientMessage(playerid, 0xFF0000FF, "Error: You are not authorized to use this command!");
return 1;
}