OnDialogResponse
#1

Help! This always kicks the player for "Pressing cancle" when he/she pressed okay

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) //the callback
{
if (dialogid == 1)
{
if (response == 1) //making sure "Login" was pressed
{
if (!strcmp(inputtext, PlayerInfo[playerid][pPassword])) //checking if it is the players password
{
OnPlayerLogin(playerid,inputtext);
return 1;
}
else //incorrect password
{
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "Invalid Password", "Invalid Password, try again", "Login", "Cancel"); //shows another dialog, with the same dialogid.
LogAttempts[playerid]++; //increments a variable to know how many time he has tried to login
if (LogAttempts[playerid] >=2) //is it greater then or equal to 2?
{
SendClientMessage(playerid, COLOR_RED, "Too many attempts, kicked");
Kick(playerid);
return 1;
}
}
else //pressed "Cancel"
{
SendClientMessage(playerid, COLOR_RED, "You must Login to play!");
Kick(playerid);
}
}
}
return 1;
}
Reply
#2

Try this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) //the callback
{
if (dialogid == 1)
{
if (response == 1) //making sure "Login" was pressed
{
if (!strcmp(inputtext, PlayerInfo[playerid][pPassword])) //checking if it is the players password
{
OnPlayerLogin(playerid,inputtext);
return 1;
}
else //incorrect password
{
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "Invalid Password", "Invalid Password, try again", "Login", "Cancel"); //shows another dialog, with the same dialogid.
LogAttempts[playerid]++; //increments a variable to know how many time he has tried to login
if (LogAttempts[playerid] >=2) //is it greater then or equal to 2?
{
SendClientMessage(playerid, COLOR_RED, "Too many attempts, kicked");
Kick(playerid);
return 1;
}
}
else //pressed "Cancel"
{
SendClientMessage(playerid, COLOR_RED, "You must Login to play!");
}
}
}
return 1;
}
Reply
#3

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) //the callback
{
  if (dialogid == 1)
  {
    if (response == 1) //making sure "Login" was pressed
    {
      if (!strcmp(inputtext, PlayerInfo[playerid][pPassword])) //checking if it is the players password
      {
        OnPlayerLogin(playerid,inputtext);
        return 1;
      }
      else //incorrect password
      {
        ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_INPUT, "Invalid Password", "Invalid Password, try again", "Login", "Cancel"); //shows another dialog, with the same dialogid.
        LogAttempts[playerid]++; //increments a variable to know how many time he has tried to login
        if (LogAttempts[playerid] >=2) //is it greater then or equal to 2?
        {
          SendClientMessage(playerid, COLOR_RED, "Too many attempts, kicked");
          Kick(playerid);
          return 1;
}
}
else //pressed "Cancel"
{
SendClientMessage(playerid, COLOR_RED, "You must Login to play!");
Kick(playerid);
}
}
}
return 1;
}
Reply
#4

Код:
else //pressed "Cancel"
{
SendClientMessage(playerid, COLOR_RED, "You must Login to play!");
Kick(playerid);
}
}
}
return 1;
}
that will still kicks the player
pawn Код:
Kick(playerid);
Reply
#5

You wrote :

if(response == 1)
{
BLAH BLAH!
}
else
{
BLAH BLAH MESSAGE
Kick(playerid);
}

You should remove that Kick(playerid).
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)