dialog not working.
#1

Hello,
I made a command that uses dialog but when I enter a certain amount nothing happens and the dialog closes.
here are the codes:
PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/charity"cmdtexttrue10) == 0)
    {
        
ShowPlayerDialog(playerid,100,DIALOG_STYLE_INPUT"Charity""How much would you like to charity""Charity""Close");
        return 
1;
    }
    return 
0;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
          case 
100:
        {
            new 
string[256];
            if(
response)
            {
                new 
type strval(inputtext);
                if(
type == 0)
                if(
GetPlayerMoney(playerid)< type)
                {
                       
GivePlayerMoney(playerid,-type);
                      
format(stringsizeof(string), "INFO: You have successfully charitied $%d"type);
                      
SendClientMessage(playerid0xFFFFFFstring);
                  }
                  else 
SendClientMessage(playerid0xFFFFFF"SERVER: You do not have that much amount in your hand");
            }
        }
    }
    return 
1;

Reply
#2

check other FS if they have the dialog response return value = 0 not 1
Reply
#3

Try this
Код:
if(type == 0)  { }
Reply
#4

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid  == 100)
    {
            new string[256];
            if(response)
            {
                new type = strval(inputtext);
                if(type == 0)
                {
                   if(GetPlayerMoney(playerid)< type)
                  {
                      GivePlayerMoney(playerid,-type);
                      format(string, sizeof(string), "INFO: You have successfully charitied $%d", type);
                      SendClientMessage(playerid, 0xFFFFFF, string);
                  }

               }
                else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your hand");
            }
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Naruto_Emilio
Посмотреть сообщение
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid  == 100)
    {
            new string[256];
            if(response)
            {
                new type = strval(inputtext);
                if(type == 0)
                {
                   if(GetPlayerMoney(playerid)< type)
                  {
                      GivePlayerMoney(playerid,-type);
                      format(string, sizeof(string), "INFO: You have successfully charitied $%d", type);
                      SendClientMessage(playerid, 0xFFFFFF, string);
                  }

               }
                else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your hand");
            }
    }
    return 1;
}
I enter a valid number like if I have 300 I enter 200 it says you don't have enough money.
Reply
#6

Код:
            if(response)
            {
                new type = strval(inputtext);
                if(GetPlayerMoney(playerid)< type)
                {
                       GivePlayerMoney(playerid, -type);
                      format(string, sizeof(string), "INFO: You have successfully charitied $%d", type);
                      SendClientMessage(playerid, 0xFFFFFF, string);
                }
                  else SendClientMessage(playerid, 0xFFFFFF, "SERVER: You do not have that much amount in your hand");
            }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)