SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/05/2014, 09:27 AM   #1
n00el
Big Clucker
 
Join Date: Jun 2012
Posts: 132
Reputation: 0
Default mysql dialog

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;

n00el is offline   Reply With Quote
Old 10/05/2014, 09:37 AM   #2
Deal-or-die
Huge Clucker
 
Deal-or-die's Avatar
 
Join Date: Oct 2010
Location: An Island 1000's of miles away
Posts: 366
Reputation: 22
Default Re: mysql dialog

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

"I'm in the country that basically invented the Internet, and your getting faster speeds on an island 1,000miles away"
Deal-or-die is offline   Reply With Quote
Old 10/05/2014, 09:53 AM   #3
n00el
Big Clucker
 
Join Date: Jun 2012
Posts: 132
Reputation: 0
Default Re: mysql dialog

My dialog list online and offline players too, onplayerclickplayer is when i am click player after tab, not i my dialog? or?
n00el is offline   Reply With Quote
Old 10/05/2014, 09:58 AM   #4
Deal-or-die
Huge Clucker
 
Deal-or-die's Avatar
 
Join Date: Oct 2010
Location: An Island 1000's of miles away
Posts: 366
Reputation: 22
Default Re: mysql dialog

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.
__________________
/////////////////////////// | Mini Moot | \\\\\\\\\\\\\\\\\\\\\\\\\\\

"I'm in the country that basically invented the Internet, and your getting faster speeds on an island 1,000miles away"
Deal-or-die is offline   Reply With Quote
Old 10/05/2014, 10:08 AM   #5
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,828
Reputation: 1401
Default Re: mysql dialog

inputtext holds the text from the listitem you selected.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 10/05/2014, 10:24 AM   #6
n00el
Big Clucker
 
Join Date: Jun 2012
Posts: 132
Reputation: 0
Default Re: mysql dialog

ok, but how i can save the inputtext? i am using another dialog for managmante players..
n00el is offline   Reply With Quote
Old 10/05/2014, 10:41 AM   #7
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,828
Reputation: 1401
Default Re: mysql dialog

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].
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 10/05/2014, 11:20 AM   #8
n00el
Big Clucker
 
Join Date: Jun 2012
Posts: 132
Reputation: 0
Default Re: mysql dialog

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?
n00el is offline   Reply With Quote
Old 10/05/2014, 11:24 AM   #9
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,828
Reputation: 1401
Default Re: mysql dialog

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.
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 10/05/2014, 11:25 AM   #10
n00el
Big Clucker
 
Join Date: Jun 2012
Posts: 132
Reputation: 0
Default Re: mysql dialog

you can give it a code pls?
n00el is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Dialog] Listing MySQL data inside a List Dialog vIBIENNYx Scripting Help 11 10/09/2012 11:19 PM
MySQL in a dialog GamingTurf Scripting Help 0 11/12/2011 05:52 PM
[mysql] [dialog] How of command to make dialog mariomako Help Archive 0 20/05/2011 09:18 PM
MySql and Dialog Help Rokzlive Help Archive 1 03/04/2011 04:36 PM
Mysql + dialog help iJumbo Help Archive 2 23/10/2010 10:45 AM


All times are GMT. The time now is 05:59 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.