10.12.2014, 06:27
this is report command i actully wanted that if player id 0 reported player id 1 then again he want to report that same guy he should get msg that " You already reported that guy?
this is what i done so far
this is what i done so far
pawn Код:
CMD:report(playerid, params[])
{
new target, reason[50], string[256], hour, minute, second, query[128], rows, fields;
gettime(hour,minute,second);
if(sscanf(params, "us[50]", target, reason)) return SendClientMessage(playerid, -1, ""RED"USAGE: "WHITE"/report <nick/id> <reason>");
if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, ""DARKRED"The player name/id you put is invalid!");
//if(target == playerid) return SendClientMessage(playerid, -1, ""DARKRED"You cannot report yourself!");
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `reports` WHERE `Name` ='%s' LIMIT 0,1",target);
mysql_tquery(mysql, query, "", "");
cache_get_data(rows, fields, mysql);
if(rows)
{
cache_get_field_content(0, "Name",Name[playerid], mysql, 129);
//we will load player's password into pInfo[playerid][Password] to be used in logging in
SendClientMessage(playerid, COLOR_YELLOW, "You have already reported that guy ! wait for it to ban if he really hacks");
}
else
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
if(pInfo[i][Admin] >= 3)
{
Reported[target] = 1;
format(string,sizeof(string), ""ORANGE"REPORT: "WHITE"%s (ID:%d) has reported %s (ID:%d) for %s |@%d:%d:%d|",GetName(playerid), playerid, GetName(target), target, reason, hour, minute, second);
SendClientMessage(i, -1, string);
GameTextForPlayer(i,"~r~~h~You've recieved a report!",2000,3);
}
}
}
new ReportList[368];
new year, month, day;
getdate(year, month, day);
format(ReportList,sizeof(ReportList),"INSERT INTO `reports` (`Reporter`,`Name`,`Reason`,`RDate`) VALUES ('%s','%s','%s','%d/%d/%d')",GetName(playerid), GetName(target), reason ,day,month,year);
mysql_function_query(mysql, ReportList, false, "", "");
new message[128];
format(message, sizeof(message), "04[REPORT] 01%s (ID:%d) has reported %s (ID:%d) for %s", GetName(playerid), playerid, GetName(target), target, reason);
IRC_GroupSay(groupID, "%#IRC_CHANNEL", message);
IRC_GroupSay(groupID, IRC_ADMIN_CHANNEL, message);
}
return 1;
}