if (strcmp("/report", cmdtext, true, 100) == 0)
{
new player[24],
reason[100];
if(sscanf(cmdtext[100], "{s}us[100]", player, reason)) return SendClientMessage(playerid, 0x00ffaa, "USAGE: /report <player> <reason>");
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerAdmin(i))
{
new string[100],
playername[30],
string2[100];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "Player: %s Reported Player: %u for the reason: %s.", playername, player, reason);
SendClientMessage(i, 0x333300, string);
format(string2, sizeof(string2), "Your report about: %u with reason %s has been send to the admins.", player, reason);
SendClientMessage(playerid, 0x333300, string2);
}
}
}
return 1;
}
if(sscanf(cmdtext, "us[100]", player, reason))
if(sscanf(cmdtext[7], "us", player, reason)) // 7 being the length of the command
if(sscanf(cmdtext, "{s}us", player, reason))
Try different things, not just combine them.
![]() Use "us[100]" and see. |
CMD:report( playerid, cmdtext[] ) //easier and BETTER.
{
new player, reason[64];
if(sscanf(cmdtext, "is[64]", player, reason)) return SendClientMessage(playerid, 0x00ffaa, "USAGE: /report <player> <reason>");
{
new playername[MAX_PLAYER_NAME], reportedname[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername)); GetPlayerName(player, reportedname, sizeof(reportedname));
new string[128];
format(string, sizeof(string), "Your report about: %s with reason %s has been send to the admins.", reportedname, reason);
SendClientMessage(playerid, 0x333300, string);
format(string, sizeof(string), "Player: %s Reported Player: %s for the reason: %s.", playername, reportedname, reason);
for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerAdmin(i)) { SendClientMessage(i, 0x333300, string); } }
}
return 1;
}