Dialog question -
Rabea - 26.06.2015
How I can when I enter a name in dialog somthing will happen to that player, example slapping him
Re: Dialog question -
Sellize - 26.06.2015
Get the inputtext and use the following function
PHP код:
stock GetPlayerIdFromName(playername[])
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new playername2[MAX_PLAYER_NAME];
GetPlayerName(i, playername2, sizeof(playername2));
if(strcmp(playername2, playername, true, strlen(playername2)) == 0)
{
return i;
}
}
}
return INVALID_PLAYER_ID;
}
Re: Dialog question -
Rabea - 26.06.2015
okey, now give me an example of dialog.
Thanks for helping
Re: Dialog question -
[XST]O_x - 26.06.2015
pawn Код:
CMD:slap(playerid,params[])
{
ShowPlayerDialog(playerid, //blahblahblah
}
public OnDialogResponse(//more blah)
{
if(dialogid == DIALOG_BLAH)
{
new id = GetPlayerIdFromName(inputtext);
Slap(id);
Re: Dialog question -
Rabea - 26.06.2015
I don't understand this mate...
I am making mdc system, I want when I enter player's name it will show the information of the player, but I couldn't make this INPUT dialog...
Re: Dialog question -
[XST]O_x - 26.06.2015
pawn Код:
enum
{
DIALOG_PLAYERNAME
}
//Here is the input dialog:
ShowPlayerDialog(playerid, DIALOG_PLAYERNAME, DIALOG_STYLE_INPUT, "Mobile Data Computer", "Enter the name of the person you want to get information about.", "Search", "Close");
This is the line that shows the dialog to the player (to the cop)
Well, to continue, you need an algorithm that searches through player data, so tell us how you store your data (database, files, which db/file system)
Re: Dialog question -
Rabea - 26.06.2015
you mean PlayerInfo[playerid][pAge] and shiz?
Re: Dialog question -
liquor - 26.06.2015
Pretty easy if you use the sscanf plugin, one can type either userid OR username and it's a pretty small code...
once again, indentation is fucked by forums...
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case DIALOG_INPUT:
{
if(response)
{
new userid;
if(sscanf(inputtext,"u",userid)) return ShowPlayerDialog(playerid,DIALOG_INPUT,DIALOG_STYLE_INPUT,"Enter name/userid","Error: Enter the name/userid","OK","Cancel");
DoSomethingToPlayer(userid); // Do whatever
}
}
}
return 1;
}
Re: Dialog question -
Rabea - 26.06.2015
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem,
{
if(dialogid == blablabla)
{
if(response)
{
switch(dialogid)
{
case DIALOG_INPUT:
{
if(response)
{
new userid;
if(sscanf(inputtext,"u",userid)) return ShowPlayerDialog(playerid,DIALOG_INPUT,DIALOG_STYLE_INPUT,"Enter name/userid","Error: Enter the name/userid","OK","Cancel");
Showplayerdialog(userid, Blabla);
}
}
}
return 1;
}
This code would work?
I am typing via phone.
Re: Dialog question -
Prokill911 - 26.06.2015
Why are you using an IF Statement on dialog response to check if the dialog is == to a certain ID...
Use a switch statement.
Pointless saying
if(dialog == blah blah
because if it doesn't == that specific dialog name, It wont do nothing what so ever.. so If you have more than 1 dialog under that..
If it doesn't == the first dialog your if statement is asking it will simpy skip an close....
This is a HELP section..
Not a "DO IT FOR ME" Section..
If you want it done for you..
Post in the right place?
All I can see in this thread is the following...
How do I do *BlahBlah*
someone tells you...
You then ask for an "example"..
He gives you one..
"I don't understand"
In other words...
Hey can someone make this "blah blah" into a dialog for me.. so I can copy paste