mysql dialog
#1

Hello.

How i can do, when i am clink in a player-s name show another dialog where i can remove him/her to the faction?

PHP Code:
Dialog:LeaderAlkalmazottak(playeridresponselistiteminputtext[])
{
    new 
string[128],dialogstr[3000];
    
strcat(dialogstr,string);
    if(
response)
    {
        switch(
listitem)
        {
            case 
0:
            {
                new 
userstring[300] = "Alkalmazottak:\n";
                
format(querysizeof(query), "SELECT nev FROM users WHERE frakcio = %d",PlayerInfo[playerid][pFrakcio]);
                
mysql_query(sqldbquery);
                
mysql_store_result();
                while(
mysql_retrieve_row())
                {
                    
mysql_fetch_field_row(query"nev");
                    
format(userstringsizeof(userstring), "%s %s \n"userstringquery);
                }
                
mysql_free_result();
                
Dialog_Show(playeridLeaderAlkalmazottakDIALOG_STYLE_LIST"Alkalmazottak kezelйse"userstring"Ok""Mйgsem");
            }
            case 
1-50:
            {
                
Dialog_Show(playeridLeaderAlkalmazottak1DIALOG_STYLE_LIST"Alkalmazottak kezelйse""Elbocsбjtбs\nFelfokozбs\nLefokozбs""Ok""Mйgsem");
            }
        }
    }
    return 
1;

Reply
#2

Have you looked into OnPlayerClickPlayer?
pawn Code:
public OnPlayerClickPlayer(playerid,clickedplayerid,source)
Then just call a dialog off of that.
Reply
#3

My dialog list online and offline players too, onplayerclickplayer is when i am click player after tab, not i my dialog? or?
Reply
#4

No sorry, I didn't quite understand what you were asking.
OnPlayerClickPlayer is only for the currently online players.

To display offline players is a little too far fetched for my knowledge. I would personally do this via a control panel on my website instead or via a command.
Reply
#5

inputtext holds the text from the listitem you selected.
Reply
#6

ok, but how i can save the inputtext? i am using another dialog for managmante players..
Reply
#7

To a global array.

An example:
pawn Code:
// global:
new Player_Inputtext[MAX_PLAYERS][128];

// OnPlayerConnect:
Player_Inputtext[playerid][0] = EOS; // reset

// in the dialog:
strcat((Player_Inputtext[playerid][0] = EOS, Player_Inputtext[playerid]), inputtext, 128); // copy string1 (inputtext) to string2 (array)
It will now store the text from inputtext to Player_Inputtext[playerid].
Reply
#8

thanks. and knows anyone how to edit the name (Player_Inputtext[playerid]) to playerid? if Player_Inputtext[playerid] is connected edit it to a playerid?
Reply
#9

You can't edit it but you can loop through all the connected players (using foreach - it's much faster!) and compare the player's name with the array you got. If they do match (check if the array is not null, otherwise it will return 0) retrieve the player's ID from the loop and if you want, store it to another global variable (if you do, don't forget to reset it) or use it directly.
Reply
#10

you can give it a code pls?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)