lspd members with dialogs -
'Pawno. - 26.06.2012
hey.
i had an simple question.
so, how can i make an dialog, with all lspd members which are online & offline? i want to make a maximum of 20 players per site (dialog msgbox, buttons are backward & forward) but i dont know how to.
a friend says i must do this with a loop but i dont know how.
ps, i use mysql (blueg) my Name Variable for Player Names in the Table is
'Name' (without the ') and the table is accounts
So i know how to choose a player in the table, i must use
"SELECT Name FROM Spieler WHERE Fraktion = '1'" but i dont know what i do now and how to make more sites in a dialog...
thanks for help!
Re: lspd members with dialogs -
Grand_Micha - 26.06.2012
German children nowadays. Loops and menues suck. Use SetPlayerColor and OnPlayerClickPlayer - a wonderful menu with Tab!
Re: lspd members with dialogs -
'Pawno. - 26.06.2012
wth did you mean?
i want to make a list with all members of an faction and not the scoreboard ...
Re: lspd members with dialogs -
Grand_Micha - 26.06.2012
What do you need it for? I mean if you make the cops blue, then you can see all of them at once on the scoreboard. You can also click them.
Re: lspd members with dialogs -
'Pawno. - 26.06.2012
Noo, an player on my server asked me for an list of all actually faction members, so i want to make an list with an dialog to see all players in the faction "xy"
if the player is offline, the text in the dialog is red. if the player is online the text is green.
Re: lspd members with dialogs -
Makaveli93 - 26.06.2012
pawn Код:
new string[512]
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerIsACop[i]) // insert your own check here
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(i, pname, sizeof(pname));
format(string, 512, "%s%s\n", string, pname);
}
}
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "Police officers online", string, "Okay", "Close");
Just a rough example.
Now, for checking offline members you would have to use MySQL or have some kind of storing system for faction members, maybe storing their names in a file?
Re: lspd members with dialogs -
'Pawno. - 26.06.2012
and what is with the limit of 20 members per site?
Re: lspd members with dialogs -
Makaveli93 - 26.06.2012
pawn Код:
new string[512]
new string2[512]
new string3[512]
//===================
new pdmembes = 0;
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerIsACop[i]) // insert your own check here
{
pdmembs += 1;
new pname[MAX_PLAYER_NAME];
GetPlayerName(i, pname, sizeof(pname));
if(pdmembes < 21)
{
format(string, 512, "%s%s\n", string, pname);
}
if(pdmembes < 41 && pdmembers > 20)
{
format(string2, 512, "%s%s\n", string2, pname);
}
if(pdmembes < 61 && pdmembers > 40)
{
format(string3, 512, "%s%s\n", string3, pname);
}
}
}
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_MSGBOX, "Police officers online", string, "Forward", "Close");
You would have to make these three string variables global, and it would work only for up to 60 pd members. This is only for those online. I haven't tested it but it should work.
Re: lspd members with dialogs -
Jonny5 - 27.06.2012
Quote:
Originally Posted by Makaveli93
You would have to make these three string variables global, and it would work only for up to 60 pd members. This is only for those online. I haven't tested it but it should work.
|
a few reasons this is flawed,
it will always show only the first dialog list.
no need for the global strings at all!
it will not show offline players
@topic
it is better to store the "page" index in a global per player var
and build the string from that index.
and use that in OnDialogResponse
to build the next dialog to be displayed.
if i get time to make a small example i will post it, but its not likely i will have the time right now.
i would also store the users online state in the database
to avoid looping threw them to check if they are online or not.
its not hard but could be very inefficient if not done correctly.
Re: lspd members with dialogs -
Makaveli93 - 27.06.2012
Quote:
Originally Posted by Jonny5
a few reasons this is flawed,
it will always show only the first dialog list.
no need for the global strings at all!
it will not show offline players
|
I never said it will show online players, nor that it would show all the dialogs. I assumed he knows how to show other dialogs.