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(playerid, response, listitem, inputtext[])
{
new string[128],dialogstr[3000];
strcat(dialogstr,string);
if(response)
{
switch(listitem)
{
case 0:
{
new userstring[300] = "Alkalmazottak:\n";
format(query, sizeof(query), "SELECT nev FROM users WHERE frakcio = %d",PlayerInfo[playerid][pFrakcio]);
mysql_query(sqldb, query);
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_fetch_field_row(query, "nev");
format(userstring, sizeof(userstring), "%s %s \n", userstring, query);
}
mysql_free_result();
Dialog_Show(playerid, LeaderAlkalmazottak, DIALOG_STYLE_LIST, "Alkalmazottak kezelйse", userstring, "Ok", "Mйgsem");
}
case 1-50:
{
Dialog_Show(playerid, LeaderAlkalmazottak1, DIALOG_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?