View Single Post
Old 26/03/2020, 09:20 PM   #2
l0gic
Big Clucker
 
Join Date: Aug 2019
Posts: 156
Reputation: 18
Default Re: Can't use command

https://forum.sa-mp.com/showthread.php?t=481257
It would save some memory
PHP Code:
#include <ps-format>
CMD:members(playeridparams[]) {
    new 
s[100];
    
format(s100"select * from users where member = '%d' order by rank desc"PlayerInfo[playerid][pLeader]);
    new 
Cache:cq mysql_query(handles);
    new 
Packed:bs[1024] = !"Nume\tGrad\tZile\n",
        
name[24],
        
rank,
        
days,
        
raport;
    for(new 
icache_num_rows(); ji++){
        
// getting database variable into local variable, makes sense not other way
        
cache_get_value_name(i"Name"name);
        
cache_get_value_name_int(i"Rank"rank);
        
cache_get_value_name_int(i"FactionDays"days);
        
cache_get_value_name_int(i"FactionRaport"raport);
        
format(bs1024, !"%s%s\t%d (%d rapoarte) %s\t%d\n"
            
bsnamerankraportGetPlayerID(name) != INVALID_PLAYER_ID ? ("Online") : ("Offline"), days);
    }
    
cache_delete(cq);
    
ShowPlayerDialog(playeridDIALOG_FACTIONMEMBERSDIALOG_STYLE_TABLIST_HEADERS"Membri factiunii tale"bs"Ok""Exit");
    return 
1;

__________________
Coding experience with: PAWN, Java, Python, Javascript, PHP and SQL for about 6 years.
If I helped you, any reputation would be appreciated.

Last edited by l0gic; 26/03/2020 at 10:16 PM.
l0gic is offline   Reply With Quote