DIALOG_STYLE_INPUT (2)
#1

Код:
if(dialogid == 8)
{
ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT,"Mute","Enter reason for the mute","Mute","Cancel");
}
if(dialogid == 9)
{
if(!response)
if(IsPlayerConnected(strval(inputtext)))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if (Muted[Player[playerid]] == 1) return SendClientMessage(playerid, red,"That player is already muted!");
format(string, sizeof(string), "%s has been muted by an Admin, Reason: %s", name);
SendClientMessageToAll(red,string);
SendClientMessage(playerid, lightblue,"The player has been succesfully muted.");
Muted[Player[playerid]] = 1;
}
else
{
SendClientMessage(playerid, red, "ERROR:Player is not connected");
}
return 1;
}

Okay, so I have this. There's no error in the compilation, but, when in-game it gets buggy.

Problem 1: Whenever I press cancel it still goes on.
Problem 2: It doesn't say the reason that I typed in the ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT,"Mute","Enter reason for the mute","Mute","Cancel");
________
Honda VFR800 history
Reply
#2

Because you have it set to do something when the player pressed cancel.

Remove this
pawn Код:
if(!response)
Reply
#3

i am using

if(response = 0) at end when i done with dialog i make if (response = 1)
Reply
#4

Quote:
Originally Posted by Joe Staff
Because you have it set to do something when the player pressed cancel.

Remove this
pawn Код:
if(!response)
Nothing happened...
Quote:
Originally Posted by ViruZZzZ_ChiLLL
Problem 1: Whenever I press cancel it still goes on.
Problem 2: It doesn't say the reason that I typed in the ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT,"Mute","Enter reason for the mute","Mute","Cancel");
Problem 3: It mutes myself and whenever I put any id number I get muted.
________
Ford Ranger Ev Picture
Reply
#5

pawn Код:
if(dialogid == 8)
{
  ShowPlayerDialog(playerid, 9, DIALOG_STYLE_INPUT,"Mute","Enter reason for the mute","Mute","Cancel");
}
if(dialogid == 9 && response)
{
  if(!IsPlayerConnected(strval(inputtext))) return SendClientMessage(playerid, red, "ERROR: Player is not connected");
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid,name,sizeof(name));
  if (Muted[Player[playerid]] == 1) return SendClientMessage(playerid, red,"That player is already muted!");
  format(string, sizeof(string), "%s has been muted by an Admin, Reason: %s", name);
  SendClientMessageToAll(red,string);
  SendClientMessage(playerid, lightblue,"The player has been succesfully muted.");
  Muted[Player[playerid]] = 1;
}
Indent.
Use returns instead of elses and 4 brackets.

Those 2 things will make scripts much easier to read.

But it won't work anyway, you ask for a STRING in dialog 9, not an integer, so can can you use strval? It will always say they aren't connected. Actually, it will say ID 0.
You also don't define what the second %s is in format().
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)