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



mysql dialog - n00el - 10.05.2014

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;




Re: mysql dialog - Deal-or-die - 10.05.2014

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


Re: mysql dialog - n00el - 10.05.2014

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


Re: mysql dialog - Deal-or-die - 10.05.2014

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.


Re: mysql dialog - Konstantinos - 10.05.2014

inputtext holds the text from the listitem you selected.


Re: mysql dialog - n00el - 10.05.2014

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


Re: mysql dialog - Konstantinos - 10.05.2014

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].


Re: mysql dialog - n00el - 10.05.2014

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?


Re: mysql dialog - Konstantinos - 10.05.2014

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.


Re: mysql dialog - n00el - 10.05.2014

you can give it a code pls?