CMD:report(playerid, params[])
{
new message[128],admins=0;
if(sscanf(params, "s[128]", message)) return SCM(playerid, COLOR_GREY, SYNTAX_MESSAGE"/report [text]");
{
if(playerVariables[playerid][pRMuted] <= 0)
{
if(playerVariables[playerid][pDr] <= 0)
{
new query[128];
format(query,sizeof(query),"SELECT * FROM `reports`");
mysql_query(query);//
new reportss = mysql_num_rows();
if(reportss == 69) return SendClientMessage(playerid, COLOR_WHITE,"{FFFFCC}Error: There're too many unreaded reports.");
foreach(Player, i)
{
if(playerVariables[i][pAdminLevel] >= 1)
{
admins++;
}
}
if(admins == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: There are no admins online.");
new ya,ma,da,ha,mia,sa;
getdate(ya,ma,da);
gettime(ha,mia,sa);
new str[512];
mysql_format(handle,str,"INSERT INTO `reports` (`player`,`message`,`time`) VALUES ('%s','%s','%02d/%02d/%d %02d:%02d:%02d')",playerVariables[playerid][pNormalName],message,da,ma,ya,ha,mia,sa);
mysql_query(str);
SendClientMessage(playerid, 0xFFFFFFFF, "{F3FF02}Your Report Message was sent to the Admins");
format(str, sizeof(str), "Report from %s [%d]: %s.",playerVariables[playerid][pNormalName],playerid, message);
submitToHelpersAndAdmins(str,COLOR_FRED);
playerVariables[playerid][pDr] = 60;
}
else
{
SCM(playerid,-1,"Poti da un report o data la un minut.");
}
}
else SCM(playerid,-1,"You are muted from /report.");
}
return 1;
}
mysql_format
CMD:report(playerid, params[])
{
new message[128],admins=0;
if(sscanf(params, "s[128]", message)) return SCM(playerid, COLOR_GREY, SYNTAX_MESSAGE"/report [text]");
if(playerVariables[playerid][pRMuted] > 0) return SCM(playerid,-1,"You are muted from /report.");
if(playerVariables[playerid][pDr] > 0) return SCM(playerid,-1,"Poti da un report o data la un minut.");
new query[128];
format(query,sizeof(query),"SELECT * FROM `reports`");
mysql_query(query);//
new reportss = mysql_num_rows();
if(reportss == 69) return SendClientMessage(playerid, COLOR_WHITE,"{FFFFCC}Error: There're too many unreaded reports.");
foreach(Player, i)
{
if(playerVariables[i][pAdminLevel] >= 1)
{
admins++;
}
}
if(admins == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: There are no admins online.");
new ya,ma,da,ha,mia,sa;
getdate(ya,ma,da);
gettime(ha,mia,sa);
new str[512];
mysql_format(handle,str,"INSERT INTO `reports` (`player`,`message`,`time`) VALUES ('%s','%s','%02d/%02d/%d %02d:%02d:%02d')",playerVariables[playerid][pNormalName],message,da,ma,ya,ha,mia,sa);
mysql_query(str);
SendClientMessage(playerid, 0xFFFFFFFF, "{F3FF02}Your Report Message was sent to the Admins");
format(str, sizeof(str), "Report from %s [%d]: %s.",playerVariables[playerid][pNormalName],playerid, message);
submitToHelpersAndAdmins(str,COLOR_FRED);
playerVariables[playerid][pDr] = 60;
return 1;
}
pawn Код:
|
[23:07:00] [debug] mysql_format [23:07:00] [debug] Run time error 19: "File or function is not found" [23:07:00] [debug] mysql_format [23:07:00] [debug] Run time error 19: "File or function is not found"
CMD:report(playerid, params[])
{
new string2[256],message[128],admins=0;
if(sscanf(params, "s[128]", message)) return SCM(playerid, COLOR_GREY, SYNTAX_MESSAGE"/report [text]");
{
if(playerVariables[playerid][pRMuted] <= 0)
{
if(playerVariables[playerid][pDr] <= 0)
{
new query[128];
format(query,sizeof(query),"SELECT * FROM `reports`");
mysql_query( query);//this is r33 , i try r33 not work ( , sec
new reportss = mysql_num_rows( );
if(reportss == 69) return SendClientMessage(playerid, COLOR_WHITE,"{FFFFCC}Error: There're too many unreaded reports.");
foreach(Player, i)
{
if(playerVariables[i][pAdminLevel] >= 1)
{
admins++;
}
}
if(admins == 0) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: There are no admins online.");
new ya,ma,da,ha,mia,sa;
getdate(ya,ma,da);
gettime(ha,mia,sa);
new str[512];
format(str,512,"INSERT INTO `reports` (`player`,`message`,`time`) VALUES ('%s','%s','%02d/%02d/%d %02d:%02d:%02d')",playerVariables[playerid][pNormalName],message,da,ma,ya,ha,mia,sa);
mysql_query( str);
format(string2, sizeof(string2), "{F3FF02}Your Report Message was sent to the Admins.");
SendClientMessage(playerid, 0xFFFFFFFF, string2);
format(string2, sizeof(string2), "Report from %s [%d]: %s.",playerVariables[playerid][pNormalName],playerid, message);
submitToHelpersAndAdmins(string2,COLOR_FRED);
playerVariables[playerid][pDr] = 60;
}
else
{
SCM(playerid,-1,"Poti da un report o data la un minut.");
}
}
else SCM(playerid,-1,"You are muted from /report.");
}
return 1;
}
[02:52:36] errorid: 2014 | error: Commands out of sync; you can't run this command now | resultid: -1 | extraid: -1 | callback: NULL | query: INSERT INTO `reports` (`player`,`message`,`time`) VALUES ('Alexey_Biazie','1','14/09/2014 02:52:36')
1. You don't need sscanf for a single parameter, use "params".
2. You shouldn't limit reports, MySQL can handle it all. 3. You need to add anti-MySQL injection measures in the script. |
Why are you using MySQL to handle report data in the first place? I'd heavily de-recommend using it for something such as report data.
|
CMD:report(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338) { SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator."); return 1; } if(PlayerInfo[playerid][pRMuted] != 0) { ShowPlayerDialog(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For marketplace orders use the /shoporder command","Close", ""); return 1; } if(JustReported[playerid] > 0) { SendClientMessageEx(playerid, COLOR_GREY, "Wait 25 seconds before sending another report!"); return 1; } if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /report [text]"); JustReported[playerid]=25; SendReportToQue(playerid, params); SendClientMessageEx(playerid, COLOR_YELLOW, "Your report message was sent to the Admins."); return 1; }
CMD:report(playerid, params[]) { if(PlayerInfo[playerid][pAmute] == 1) { SendClientMessageEx(playerid, COLOR_RED, "You are muted from using /report!"); return 1; } if(noam == 1) { SendClientMessageEx(playerid, COLOR_GRAD2, " The Report System has been disabled by a Manager, try again later."); return 1; } if(IsAdmin(playerid)) { new toid, message[128]; if(sscanf(params, "is[128]", toid, message)) return Syntax(playerid, "[Report]", "[playerid] [message]"); if(strlen(message) > 128) return Error(playerid, "Your message cannot be longer than 128 characters."); if(!IsPlayerConnected(toid)) return Error(playerid, "That player is not connected!"); new string[128]; format(STRING, "Admin Report from %s: %s", GetPlayerNameEx(playerid), message); SendClientMessageEx(toid, COLOR_RED, string); format(STRING, "Admin %s [%d] > %s [%d]: %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(toid), toid, message); SendAdminMessage(COLOR_RED,string); Log("logs/report.log", string); PlayerInfo[playerid][pAMSSent] ++; } else { new message[80]; if(sscanf(params, "s[80]", message)) return Syntax(playerid, "[Report]", "[message]"); if(strlen(message) > 80) return Error(playerid, "Your message cannot be longer than 80 characters."); new string[128]; format(STRING, "Report from %s [%d]: %s", GetPlayerNameEx(playerid), playerid, message); SendAdminMessage(COLOR_RED,string); format(STRING, "Your message, %s, has been sent.", message); SendClientMessageEx(playerid, COLOR_RED, string); format(STRING, "Player %s [%d] > Admins: %s", GetPlayerNameEx(playerid), playerid, message); Log("logs/report.log", string); } return 1; }
Код:
CMD:report(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] < 1338) { SendClientMessageEx(playerid, COLOR_GRAD2, "You can't submit reports as an administrator."); return 1; } if(PlayerInfo[playerid][pRMuted] != 0) { ShowPlayerDialog(playerid,7955,DIALOG_STYLE_MSGBOX,"Report blocked","You are blocked from submitting any reports!\n\nTips when reporting:\n- Report what you need, not who you need.\n- Be specific, report exactly what you need.\n- Do not make false reports.\n- Do not flame admins.\n- Report only for in-game items.\n- For marketplace orders use the /shoporder command","Close", ""); return 1; } if(JustReported[playerid] > 0) { SendClientMessageEx(playerid, COLOR_GREY, "Wait 25 seconds before sending another report!"); return 1; } if(isnull(params)) return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /report [text]"); JustReported[playerid]=25; SendReportToQue(playerid, params); SendClientMessageEx(playerid, COLOR_YELLOW, "Your report message was sent to the Admins."); return 1; } |