Report System
#10

this have to work well cause it tested
PHP код:
CMD:report(playerid,params[])
{
    new 
reason[60],pid,Query[120];
    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);
    new 
day1,month1,year1,Date1[128]; getdate(year1month1day1);
    
format(Date1,sizeof Date1,"%d-%d-%d",year1,month1,day1);
    
mysql_format(mysqlQuerysizeof(Query), "INSERT INTO `reports` (`Name`, `Reason`, `Date`) VALUES ('%s', '%s', '%s')",GPN(pid),reason,Date1);
    
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;

new /reports command this gonna show last 10 reports
PHP код:
CMD:reports(playerid,params[]) {
   if(
IsPlayerAdmin(playerid)) {
   new 
Query[250];
   
mysql_format(mysqlQuerysizeof(Query),"SELECT * FROM `reports`"); // read player account
   
mysql_tquery(mysqlQuery"Reports1""i"playerid); // to read if player account exist
   
return 1;
   } else return 
SendClientMessage(playerid,-1,"ERROR:You should be rcon to use this command");
}
forward Reports1(playerid);
public 
Reports1(playerid) {
      new 
rowsfields;
      
cache_get_data(rowsfieldsmysql);
      if(
rows) {
      new 
string[128],handle[1000];
      new 
Name1[MAX_PLAYER_NAME+1],Reason[128],Date[128];
      
strcat(handle,"Name\tReason\tDate");
      if(
cache_get_row_count(mysql) >= 10) {
      
cache_get_row(cache_get_row_count()-10Name1); cache_get_row(cache_get_row_count()-12Reason); cache_get_row(cache_get_row_count()-13Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-20Name1);  cache_get_row(cache_get_row_count()-22Reason); cache_get_row(cache_get_row_count()-23Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-30Name1); cache_get_row(cache_get_row_count()-32Reason); cache_get_row(cache_get_row_count()-33Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-40Name1); cache_get_row(cache_get_row_count()-42Reason); cache_get_row(cache_get_row_count()-43Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-50Name1); cache_get_row(cache_get_row_count()-52Reason); cache_get_row(cache_get_row_count()-53Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-60Name1); cache_get_row(cache_get_row_count()-62Reason); cache_get_row(cache_get_row_count()-63Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-70Name1); cache_get_row(cache_get_row_count()-72Reason); cache_get_row(cache_get_row_count()-73Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-80Name1); cache_get_row(cache_get_row_count()-82Reason); cache_get_row(cache_get_row_count()-83Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-90Name1); cache_get_row(cache_get_row_count()-92Reason); cache_get_row(cache_get_row_count()-93Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      
cache_get_row(cache_get_row_count()-100Name1); cache_get_row(cache_get_row_count()-102Reason); cache_get_row(cache_get_row_count()-103Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s\t%s",Name1,Reason,Date); strcat(handle,string);
      return 
ShowPlayerDialog(playerid3654DIALOG_STYLE_TABLIST_HEADERS"Reports",handle,"Exit""");
      }
      if(
cache_get_row_count() >= 10) {
      
cache_get_row(100Name1); cache_get_row(102Reason); cache_get_row(103Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 9) {
      
cache_get_row(80Name1); cache_get_row(82Reason); cache_get_row(83Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 8) {
      
cache_get_row(70Name1); cache_get_row(72Reason); cache_get_row(73Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 7) {
      
cache_get_row(60Name1); cache_get_row(62Reason); cache_get_row(63Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 6) {
      
cache_get_row(50Name1); cache_get_row(52Reason); cache_get_row(53Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 5) {
      
cache_get_row(40Name1); cache_get_row(42Reason); cache_get_row(43Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 4) {
      
cache_get_row(30Name1); cache_get_row(32Reason); cache_get_row(33Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 3) {
      
cache_get_row(20Name1); cache_get_row(22Reason); cache_get_row(23Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 2) {
      
cache_get_row(10Name1);cache_get_row(12Reason); cache_get_row(13Date);
      
format(string,sizeof string,"\n%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      if(
cache_get_row_count() >= 1) {
      
cache_get_row(00Name1); cache_get_row(02Reason); cache_get_row(03Date);
      
format(string,sizeof string,"\n\%s\t%s\t%s\t%s",Name1,Reason,Date);
      
strcat(handle,string);}
      
ShowPlayerDialog(playerid3654DIALOG_STYLE_TABLIST_HEADERS"Reports",handle,"Exit""");
      }
      if(!
rows) {
      
SendClientMessage(playerid,-1,"There Are no Reports at this moment");
   }
      return 
1;

now i'll fix the dreport :c, also i hope this both gonna work :d

and here we go delete report:
PHP код:
CMD:dreport(playerid,params[]) {
     if(
IsPlayerAdmin(playerid)) {
     if(
isnull(params)) return SendClientMessage(playerid,-1,"usage /dreport [name]");
     new 
Query[250];
     
mysql_format(mysqlQuerysizeof(Query),"SELECT * FROM `reports` WHERE `Name` = '%e'",params); // read player account
     
mysql_tquery(mysqlQuery"DeleteReport""i"playerid); // to read if player account exist
     
} else return SendClientMessage(playerid,-1,"ERROR:You should be rcon to use this command");
     return 
1;
}
forward DeleteReport(playerid);
public 
DeleteReport(playerid){
 new 
rowsfields;
 
cache_get_data(rowsfieldsmysql);
 if(
rows)
     {
     new 
Query[250],Name1[MAX_PLAYER_NAME+1];
     
cache_get_field_content(0"Name"Name1mysqlsizeof(Name1));
     
format(Query100"DELETE FROM `reports` WHERE `Name` = '%s'"Name1);
     
mysql_tquery(mysqlQuery"""");
     
SendClientMessage(playerid,-1,"Report Successfully Deleted");
 } if(!
rows) {
     return 
SendClientMessage(playerid,-1,"Name Not Exist on database");
    }
 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: 3 Guest(s)