[Ajuda] Comando /search
#1

Bom pessoa, editei este code de um FS e coloquei no meu GM, ele funciona da seguinte forma:
PHP код:
CMD:rreports(playeridparams[])
{
    new 
name[MAX_PLAYER_NAME];
    if(
sscanf(params"s[24]"name)) return SendClientMessage(playeridCOLOR_THISTLE"USAGE: /rreports [playername]");
    
SendClientMessage(playeridCOLOR_ORANGE_RED" ");
    new 
string[150], arg[56];
    
format(stringsizeof(string), "- Search result for %s:\n"name);
    
SendClientMessage(playeridCOLOR_DODGER_BLUEstring);
    new 
count 0;
    for(new 
1DB::GetHighestRegisteredKey(gGlobal[s_bugreporttable]); <= ji++)
    {
        new 
uName[MAX_PLAYER_NAME];
          
DB::GetStringEntry(gGlobal[s_bugreporttable], i"username"uName);
        if(
strfind(uNamenametrue) != -1)
        {
            
count += 1;
            
            
strcat(string" [Bug Report: ");
            
DB::GetStringEntry(gGlobal[s_bugreporttable], i"bugreport"arg);
            
strcat(stringarg);
            
strcat(string" | Date: ");
            
DB::GetStringEntry(gGlobal[s_bugreporttable], i"date"arg);
            
strcat(stringarg);
            
strcat(string"]");
            
SendClientMessage(playeridCOLOR_DODGER_BLUEstring);
        }
    }
    if(! 
count) return SendClientMessage(playeridCOLOR_DODGER_BLUE"- No account found with that part of name!");
    return 
1;

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:

PHP код:
CMD:sreports(playeridparams[])
{
    new 
name[MAX_PLAYER_NAME];
    
SendClientMessage(playeridCOLOR_ORANGE_RED" ");
    new 
string[150], arg[56];
    
format(stringsizeof(string), "- Search result for %s:\n"name);
    
SendClientMessage(playeridCOLOR_DODGER_BLUEstring);
    new 
count 0;
    for(new 
1DB::GetHighestRegisteredKey(gGlobal[s_bugreporttable]); <= ji++)
    {
        new 
uName[MAX_PLAYER_NAME];
          
DB::GetStringEntry(gGlobal[s_bugreporttable], i"username"uName);
        if(
strfind(gUser[playerid][u_ifbugexist] == 1true) != -1)
        {
            if(
gUser[playerid][u_ifbugexist] == 1)
            {
            
count += 1;
            
            
strcat(string" [Bug Report: ");
            
DB::GetStringEntry(gGlobal[s_bugreporttable], i"bugreport"arg);
            
strcat(stringarg);
            
strcat(string" | Date: ");
            
DB::GetStringEntry(gGlobal[s_bugreporttable], i"date"arg);
            
strcat(stringarg);
            
strcat(string"]");
            
SendClientMessage(playeridCOLOR_DODGER_BLUEstring);
            }
        }
    }
    if(! 
count) return SendClientMessage(playeridCOLOR_DODGER_BLUE"- No account found with that part of name!");
    return 
1;

ta errado, mas й mais ou menos isso...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)