Only players
#1

Hey guys i have this /richlist command i want to do only for players so if an admin/helper have like 10.000.000$ and a normal player have 8kk that player should be first not that admin/helper with 10kk

Код HTML:
CMD:richlist(playerid, params[])
{
    if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
    if(!IsManager(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "Nu ai gradul necesar ca sa folosesti aceasta comanda!");
    const max_sort = 10;
    new string[500 + (MAX_PLAYER_NAME+1)*max_sort];
    new Cache:result = mysql_query(handle, "SELECT `Name`,`Cash`,`Account`,`HoursPlayed` FROM `players` WHERE `Cash` > 0 ORDER BY `Cash` DESC LIMIT 20");
    new tmp = cache_num_rows();
    if(tmp)
    {
        strcat(string,"Nume\tBani la el\tBani in banca\tOre jucate\n");
        for(new i,a[11],c[11],h[11],n[MAX_PLAYER_NAME]; i<tmp; i++)
        {
            cache_get_field_content(i, "Name", n);
            cache_get_field_content(i, "Cash", c);
            cache_get_field_content(i, "Account", a);
            cache_get_field_content(i, "HoursPlayed", h);
            format(string,sizeof(string),"%s%s\t%d\t%d\t%d\t%d\n",string,n,strval©,strval(a),strval(h));
        }
    }
    cache_delete(result);
    ShowPlayerDialog(playerid, 525242, DIALOG_STYLE_TABLIST_HEADERS, "Top 20 jucatori bogati", string, "Iesi", "");
    return 1;
}
any idea?
Reply
#2

maybe add this below the cache num row function

PHP код:
if(PlayerInfo[playerid][pAdmin] < 1)
{
         
//The code inside cache num rows

Reply
#3

PHP код:
CMD:richlist(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] > 0) return SendClientMessage(playerid,-1,"Not authorized "); //replace playerinfo and padmin by your variable
    
if(gLogged[playerid] == 0) return SendClientMessage(playeridCOLOR_ERROR"Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
    if(!
IsManager(playerid)) return SendClientMessage(playeridCOLOR_ERROR"Nu ai gradul necesar ca sa folosesti aceasta comanda!");
    const 
max_sort 10;
    new 
string[500 + (MAX_PLAYER_NAME+1)*max_sort];
    new 
Cache:result mysql_query(handle"SELECT `Name`,`Cash`,`Account`,`HoursPlayed` FROM `players` WHERE `Cash` > 0 ORDER BY `Cash` DESC LIMIT 20");
    new 
tmp cache_num_rows();
    if(
tmp)
    {
        
strcat(string,"Nume\tBani la el\tBani in banca\tOre jucate\n");
        for(new 
i,a[11],c[11],h[11],n[MAX_PLAYER_NAME]; i<tmpi++)
        {
            
cache_get_field_content(i"Name"n);
            
cache_get_field_content(i"Cash"c);
            
cache_get_field_content(i"Account"a);
            
cache_get_field_content(i"HoursPlayed"h);
            
format(string,sizeof(string),"%s%s\t%d\t%d\t%d\t%d\n",string,n,strval(c),strval(a),strval(h));
        }
    }
    
cache_delete(result);
    
ShowPlayerDialog(playerid525242DIALOG_STYLE_TABLIST_HEADERS"Top 20 jucatori bogati"string"Iesi""");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)