06.12.2015, 16:46
Bom pessoa, editei este code de um FS e coloquei no meu GM, ele funciona da seguinte forma:
Ele procura os dados de report do player, do qual estou pesquisando o nome.
Mas quero fazer algo parecido, porйm ele precisa procurar TODOS que reportaram:
ta errado, mas й mais ou menos isso...
PHP код:
CMD:rreports(playerid, params[])
{
new name[MAX_PLAYER_NAME];
if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_THISTLE, "USAGE: /rreports [playername]");
SendClientMessage(playerid, COLOR_ORANGE_RED, " ");
new string[150], arg[56];
format(string, sizeof(string), "- Search result for %s:\n", name);
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
new count = 0;
for(new i = 1, j = DB::GetHighestRegisteredKey(gGlobal[s_bugreporttable]); i <= j; i++)
{
new uName[MAX_PLAYER_NAME];
DB::GetStringEntry(gGlobal[s_bugreporttable], i, "username", uName);
if(strfind(uName, name, true) != -1)
{
count += 1;
strcat(string, " [Bug Report: ");
DB::GetStringEntry(gGlobal[s_bugreporttable], i, "bugreport", arg);
strcat(string, arg);
strcat(string, " | Date: ");
DB::GetStringEntry(gGlobal[s_bugreporttable], i, "date", arg);
strcat(string, arg);
strcat(string, "]");
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
}
}
if(! count) return SendClientMessage(playerid, COLOR_DODGER_BLUE, "- No account found with that part of name!");
return 1;
}
Mas quero fazer algo parecido, porйm ele precisa procurar TODOS que reportaram:
PHP код:
CMD:sreports(playerid, params[])
{
new name[MAX_PLAYER_NAME];
SendClientMessage(playerid, COLOR_ORANGE_RED, " ");
new string[150], arg[56];
format(string, sizeof(string), "- Search result for %s:\n", name);
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
new count = 0;
for(new i = 1, j = DB::GetHighestRegisteredKey(gGlobal[s_bugreporttable]); i <= j; i++)
{
new uName[MAX_PLAYER_NAME];
DB::GetStringEntry(gGlobal[s_bugreporttable], i, "username", uName);
if(strfind(gUser[playerid][u_ifbugexist] == 1, true) != -1)
{
if(gUser[playerid][u_ifbugexist] == 1)
{
count += 1;
strcat(string, " [Bug Report: ");
DB::GetStringEntry(gGlobal[s_bugreporttable], i, "bugreport", arg);
strcat(string, arg);
strcat(string, " | Date: ");
DB::GetStringEntry(gGlobal[s_bugreporttable], i, "date", arg);
strcat(string, arg);
strcat(string, "]");
SendClientMessage(playerid, COLOR_DODGER_BLUE, string);
}
}
}
if(! count) return SendClientMessage(playerid, COLOR_DODGER_BLUE, "- No account found with that part of name!");
return 1;
}