14.12.2014, 16:39
so the problem is Text4 is not updating when someone reports a players that shows but the 2nd i mean text4 is not updating
this code works just text4 is not updating it shows the past report like i mean
code
this code works just text4 is not updating it shows the past report like i mean
pawn Код:
Report JeaSon (ID:2) has reported kingx (ID:5) for health hacking // this is the 1st one this works fine
Report JeaSon (ID:2) has reported Kingx (ID:5) for f**k off // this one isnot updating after i did another report
so i mean it should update like this
Report JeaSon(ID:2) has reported kingx (ID:5) for new report // so this is the new one
and 2nd one should be like
Report JeaSon (ID:2) has reported kingx (ID:5) for health hacking // so this is not happning i need help
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], str[256];
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, "%#yrs", message);
IRC_GroupSay(groupID, IRC_ADMIN_CHANNEL, message);
format(str, sizeof(str), "~y~~h~Report from %s (ID:%d) ~n~Reported %s (ID:%d) for ~n~%s", GetName(playerid), playerid, GetName(target), target, reason);
TextDrawSetString(Text2, str);
}
return 1;
}
stock ShowReportsTextdraw(playerid)
{
new Query[100];
format(Query,sizeof(Query),"SELECT * FROM `reports` ORDER BY `ID` DESC LIMIT 2");
mysql_function_query(mysql, Query, true, "DisplayReportsx", "d", playerid);
TextDrawShowForPlayer(playerid, Text0);
TextDrawShowForPlayer(playerid, Text1);
TextDrawShowForPlayer(playerid, Text2);
TextDrawShowForPlayer(playerid, Text3);
TextDrawShowForPlayer(playerid, Text4);
TextDrawShowForPlayer(playerid, Text5);
TextDrawShowForPlayer(playerid, Text6);
return 1;
}
stock DestoryReportsTextDraw(playerid)
{
TextDrawHideForPlayer(playerid, Text0);
TextDrawHideForPlayer(playerid, Text1);
TextDrawHideForPlayer(playerid, Text2);
TextDrawHideForPlayer(playerid, Text3);
TextDrawHideForPlayer(playerid, Text4);
TextDrawHideForPlayer(playerid, Text5);
TextDrawHideForPlayer(playerid, Text6);
return 1;
}
public DisplayReportsx(playerid)
{
new rows, fields, target;
cache_get_data(rows, fields, mysql);
if(rows)
{
new string[1000], reason[50], reporter[MAX_PLAYER_NAME], reportedplayer[MAX_PLAYER_NAME];
for(new i = 0; i < rows; i++)
{
cache_get_field_content(i, "Reporter", reporter, mysql);
cache_get_field_content(i, "Name", reportedplayer, mysql);
cache_get_field_content(i, "Reason", reason, mysql);
format(string, sizeof(string), "~y~~h~ Report from %s (ID:%d) ~n~Reported %s (ID:%d) for~n~%s",reporter ,playerid ,reportedplayer, target, reason);
TextDrawSetString(Text4, string);
}
}
else return SendClientMessage(playerid, -1, ""RED"[REPORTS] "WHITE"There are no reports to be shown.");
return 1;
}