Report System
#9

function for server reports
PHP код:
function ServerReports(playerid
{
      new 
rowsfields;
      
cache_get_data(rowsfieldsmysql);
      if(
rows) {
      new 
string[500];
      new 
gName[MAX_PLAYER_NAME+1],Reason[128],Date[128];
      
      
cache_get_field_content(0"Name"gNamesizeof(gName));
      
cache_get_field_content(0"Reason"Reasonsizeof(Reason));
      
cache_get_field_content(0"Date"Datesizeof(Date));
      
format(string,sizeof string,"Name\tReason\tDate\n\%s\t%s\t%s",gName,Reason,Date);
      
ShowPlayerDialog(playerid, -1DIALOG_STYLE_TABLIST_HEADERS"Reports",string,"Exit""");
  }
  return 
1;

report command
PHP код:
CMD:report(playerid,params[])
{
    new 
reason[60],pid,Query[120],date,month,year;
    
getdate(year,month,date);
    new 
ReportDate getdate();
    if(
sscanf(params,"us[60]",pid,reason)) return SendClientMessage(playerid,COLOR_RED," SERVER : /report [id] [ reason ]");
    if(
pid == INVALID_PLAYER_ID || !IsPlayerConnected(pid)) return ErrorMessages(playerid,2);
    
SendFM(playerid,COLOR_LIGHTRED,"You have reported player %s(%d) Reason: %s",GPN(pid),pid,reason);
    
mysql_format(mysqlQuerysizeof(Query), "INSERT INTO `reports` (`Name`, `Reason`, `Date`) VALUES ('%s', '%s', '%s')",GPN(pid),reason,ReportDate);
    
mysql_tquery(mysql,Query);
    
printf(Query);
    foreach(new 
iPlayer)
    {
        if(
pinfo[i][Admin] >= 1)
        
SendFM(i,COLOR_WHITE,""COL_RED"PLAYER"COL_WHITE": %s(%d) "COL_RED"REPORTED"COL_WHITE":%s(%d) "COL_RED"REASON"COL_WHITE":%s(%d)",GPN(playerid),playerid,GPN(pid),pid,reason);
    }
    return 
1;
    
}
CMD:reports(playerid,params[]) 
{
   if(
pinfo[playerid][Admin] < 1) return 0;
            new 
Query[250];
        
mysql_format(mysqlQuerysizeof(Query),"SELECT * FROM `reports` LIMIT 10"); // read player account
        
mysql_tquery(mysqlQuery"ServerReports""i"playerid); // to read if player account exist
    
return 1;

Reply


Messages In This Thread
Report System - by vassilis - 12.11.2015, 09:07
Re: Report System - by jlalt - 12.11.2015, 09:12
Re: Report System - by vassilis - 12.11.2015, 09:16
Re: Report System - by jlalt - 12.11.2015, 09:38
Re: Report System - by vassilis - 12.11.2015, 09:45
Re: Report System - by jlalt - 12.11.2015, 10:00
Re: Report System - by vassilis - 12.11.2015, 10:10
Re: Report System - by jlalt - 12.11.2015, 11:04
Re: Report System - by vassilis - 12.11.2015, 11:22
Re: Report System - by jlalt - 12.11.2015, 12:59

Forum Jump:


Users browsing this thread: 1 Guest(s)