SA-MP Forums Archive
Command - 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: Command (/showthread.php?tid=615236)



Command - StR_MaRy - 19.08.2016

Hey guys can some1 help me how to create a command to see every single player who exist on my DB accounts with rank 7 ?

like /rank and give me a list with every user

StR_Marian

John_Smith

can some1 help me i don't know how to do it


Re: Command - MEW273 - 19.08.2016

What type of database are you using?


Re: Command - StR_MaRy - 19.08.2016

sql , users is the table with all account's and clans with all the clans from server


Re: Command - MEW273 - 19.08.2016

Simply include this MySQL query in your /rank command:
Код:
SELECT * FROM users WHERE rank='7'
It will return all user accounts where rank is equal to 7. If you need help creating the command can you let me know both if you are using a command processor (such as zcmd) and what version of MySQL you are using.


Re: Command - StR_MaRy - 19.08.2016

yea i need help in creating the comand i realy don't know how to add this line , i use zcmd and mysql version 5.1

and in my users table is CRank not only Rank , Rank is only for faction leader :P


Re: Command - iLearner - 19.08.2016

PHP код:
COMMAND:rank(playeridparams[])
{
  if(
playerData[playerid][playerLevel] >= 1// your admin system here
  
{
 
    new 
query[200], pname[24];
    
format(querysizeof(query),"SELECT username(whatever you called users row) FROM `playerdata`(what ever you called the table) WHERE CRank = 7 LIMIT 1");
    
mysql_query(query);
    
mysql_store_result();
    new 
rows mysql_num_rows(); 
   if(
rows == 1)
    {
      while(
mysql_fetch_row(query))
      {
        
mysql_fetch_field("playerName"pname);
        new 
string[128];
        
format(stringsizeof(string),"Username: %s  ",pname);
        
SendClientMessage(playerid0xFF0000FFstring);
      }
      
    }
    if(!
rows)
    {
      
SendClientMessage(playerid0xFF0000FF,"SERVER: No players found with rank = 7");
    }
  }
  else return 
SendClientMessage(playerid0xFF0000FF,"You are not authorized to use this command!");
  
mysql_free_result();
  return 
1;