Only players - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Only players (
/showthread.php?tid=628975)
Only players -
StR_MaRy - 17.02.2017
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?
Re: Only players -
JesterlJoker - 17.02.2017
maybe add this below the cache num row function
PHP код:
if(PlayerInfo[playerid][pAdmin] < 1)
{
//The code inside cache num rows
}
Re: Only players -
StrikerZ - 18.02.2017
PHP код:
CMD:richlist(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] > 0) return SendClientMessage(playerid,-1,"Not authorized "); //replace playerinfo and padmin by your variable
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(c),strval(a),strval(h));
}
}
cache_delete(result);
ShowPlayerDialog(playerid, 525242, DIALOG_STYLE_TABLIST_HEADERS, "Top 20 jucatori bogati", string, "Iesi", "");
return 1;
}