#1

How can i to retrieve data from mysql?
The player is offline, but i have to know what is his/her faction number.
Among all the registered player show you who they are in no. 1 fraction into a SendClientMessage

A lot of thanks.
Reply
#2

up pls
Reply
#3

Get all the datas with a for(each) loop, then check if the player's faction corresponds to the faction number you renseigned.
If it does, get the datas of the player with a usual cache_get_field_content(_int/_float)
If it doesn't, simply use "continue;" to skip this value of the number then check the next one.

Good luck.
Reply
#4

can you give me an example?
Код:
      			for(new i=0; 10000; i++)
    			{ 
        			if(What i put here?)
        			{
						    format(string, sizeof(string), "%s\n",GetRPName(i));
						    strcat(dialogstr,string);
						    Dialog_Show(playerid, PDLeaderAlkalmazott, DIALOG_STYLE_LIST, "Alkalmazottak kezelйse", dialogstr, "Ok", "Mйgsem");
		           	}
				}
Reply
#5

10000 is too much.
MAX_PLAYERS should be 500 if you have the "regular" server package.

The 800 and the 1000 players package are available but it will most likely be useless in your case.

Do like that

PHP код:

for(new 0MAX_PLAYERSi++)
{
   
format(querysizeof(query), "SELECT * FROM `Players` WHERE `uid` = '%d' "PlayerInfo[i][pUID]);
   
mysql_tquery(1query"OnPlayerDataFetched""i"i);
}
forward OnPlayerDataFetched(playerid);
public 
OnPlayerDataFetched(playerid)
{
   new 
fac cache_get_field_content_int(0"FactionNumber");
   if(
fac == FactionNumberYouImpose)
   {
         
// the format and others things go here
   

But show the dialog ONLY at the end of the loop, means OUT of the loop, either it will show as many dialogs as members of the factionto "playerid'

EDIT : Edited, small fail from me, sorry.
Reply
#6

Its ok for me. But its not good. Its list only the online players who in the faction. I would to list all player (include offline) who in the faction
Reply
#7

Edited, sorry.
I use "uid", which stands for "unique id", because it's the system I use to see, and the system I use.

Use a random at register to create and assign the number to the player, then use it instead of the player's name to do more things than using name.
Reply
#8

thats it! thanks man! +
Reply
#9

PHP код:
forward OnPlayerDataFetched(playerid);
public 
OnPlayerDataFetched(playerid)
{
    new 
string[128],dialogstr[3000];
    new 
frakcio cache_get_field_content_int(0,"34");
     if(
frakcio == 1)
       {
        
format(stringsizeof(string), "%s\n",GetRPName(playerid));
           
strcat(dialogstr,string);
           
Dialog_Show(playeridPDLeaderAlkalmazottDIALOG_STYLE_LIST"Alkalmazottak kezelйse"dialogstr"Ok""Mйgsem");
       }

PHP код:
                for(new 0MAX_PLAYERSi++)
                {
                   
format(querysizeof(query), "SELECT * FROM `users` WHERE `id` = '%d' "PlayerInfo[i][pID]);
                   
mysql_tquery(1query"OnPlayerDataFetched""i"i);
                } 
uuhm. its not working :/ what's wrong?
Reply
#10

pawn Код:
forward OnPlayerDataFetched(i);
public OnPlayerDataFetched(i)
{
    new string[128],dialogstr[3000];
    new frakcio = cache_get_field_content_int(0,"34");
     if(frakcio == 1)
       {
        format(string, sizeof(string), "%s\n",GetRPName(i));
           strcat(dialogstr,string);
           Dialog_Show(i, PDLeaderAlkalmazott, DIALOG_STYLE_LIST, "Alkalmazottak kezelйse", dialogstr, "Ok", "Mйgsem");
       }
Reply


Forum Jump:


Users browsing this thread: