Dialog getplayerinput (+rep)
#1

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
Reply
#2

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

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);
Reply
#4

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)