SA-MP Forums Archive
Dialog getplayerinput (+rep) - 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: Dialog getplayerinput (+rep) (/showthread.php?tid=433665)



Dialog getplayerinput (+rep) - NicholasA - 28.04.2013

So i have

Код:
enum PlayerVariables
{
	deltaOwner[MAX_PLAYER_NAME],
};
new PlayerVar[MAX_PLAYERS][PlayerVariables];
And i have an input dialog where you can change the deltaOwner
How can I change the value of deltaOwner and how can I display it in for example a SendClientMessage?
Thx


Re: Dialog getplayerinput (+rep) - Avi Raj - 28.04.2013

For SendClientMessage:-
pawn Код:
SendClientMessage(playerid, COLOR_YELLOW,"Delta Owner : %d",PlayerVar[playerid][deltaOwner);



Re : Re: Dialog getplayerinput (+rep) - DaTa[X] - 28.04.2013

Quote:
Originally Posted by Avi Raj
Посмотреть сообщение
For SendClientMessage:-
pawn Код:
SendClientMessage(playerid, COLOR_YELLOW,"Delta Owner : %d",PlayerVar[playerid][deltaOwner);
Wrong you have to format it
pawn Код:
new Owner[100];
format(Owner,sizeof(Owner)," Delta Owner : %d",PlayerVar[playerid][deltaOwner);
SendClientMessage(playerid,-1,Owner);



Re: Dialog getplayerinput (+rep) - Lordzy - 28.04.2013

You can format the 'inputtext' of the dialog and then show it up as a message and set the value of the string variable.
Here's a small code (example) :
pawn Код:
enum eg
{
 Downer[24],
}

new Examples[MAX_PLAYERS][eg];

CMD:changedowner(playerid, params[])
{
 ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "[Change]Delta Owner", "Please type in below your new delta's owner.", "Change", "Cancel");
 return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
 if(dialogid == 1)
 {
  if(!response) return SendClientMessage(playerid, -1, "You have cancelled changing your delta's owner."); //If player clicks the second button, i.e: 'Cancel'.
  else if(response) //If first button, i.e: 'Change'
  {
   new string[128];
   format(string, sizeof(string), "You have changed your Delta's owner to %s", inputtext);
   format(Examples[playerid][Downer], 24, "%s", inputtext); //Sets the var's value to the inputtext.
   SendClientMessage(playerid, -1, string);
  }
 }
 return 1;
}