SA-MP Forums Archive
DIALOG_STYLE_INPUT (2) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: DIALOG_STYLE_INPUT (2) (/showthread.php?tid=144803)



DIALOG_STYLE_INPUT (2) - ViruZZzZ_ChiLLL - 29.04.2010

Код:
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


Re: DIALOG_STYLE_INPUT (2) - Joe Staff - 29.04.2010

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

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



Re: DIALOG_STYLE_INPUT (2) - Lajko1 - 29.04.2010

i am using

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


Re: DIALOG_STYLE_INPUT (2) - ViruZZzZ_ChiLLL - 29.04.2010

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


Re: DIALOG_STYLE_INPUT (2) - Mikep. - 29.04.2010

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().