30.12.2010, 11:40
Can some one make a Report Dialog for me? I have tired it, but it was fail -,-.
Please help me.
]B4E[kengston
Please help me.
]B4E[kengston
if(strcmp(cmd, "/report", true) == 0)
{
if(!CanUseCmd(PlayerInfo[playerid][pID], cmd)) return SendClientMessage(playerid, COLOR_LIGHTRED, ">> You are not eligible to use this command, because of misuse!");
if(IsPlayerConnected(playerid))
{
if(Ticket[playerid] > 0)
{
SendClientMessage(playerid, COLOR_GRAD1, ">> You already have an open ticket with an admin, type /answer to talk to him.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD1, ">> That's not the way, try: /report (message)");
return 1;
}
SendClientMessage(playerid, COLOR_GRAD1, "Your report message has been sent to the admins online.");
format(string, sizeof(string), "Report from [%d] %s: %s", playerid, sendername, (result));
SendAdminMessage(COLOR_YELLOW2, string);
}
return 1;
}
public SendAdminMessage(color, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] >= 1)
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
if(strcmp(cmd, "/report", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new sendername[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, sendername, sizeof(sendername));
SendClientMessage(playerid, COLOR_GRAD1, "Your report message has been sent to the admins online.");
format(string, sizeof(string), "Report from [%d] %s: %s", playerid, sendername, cmdtext);
SendAdminMessage(COLOR_YELLOW2, string);
}
return 1;
}
COMMAND:report(playerid, params[])
{
new text[128], string[128], reportname[MAX_PLAYER_NAME];
if(sscanf(params, "s[127]", text)) SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /report (message)");
GetPlayerName(playerid, reportname, sizeof(reportname));
format(string, sizeof(string), "Report from %s [%d]: %s ))", reportname, playerid, text);
SendAdminMessage(0xFFF200, string);
return 1;
}