Problem in Imput Dialog. -
ricardo178 - 27.07.2012
Hello. Well, i felt to script a bit and decided to make something rare. A poker system. Well, all is going good but i am having a little problem with the bet dialog.
I use imputtext OnDialogResponse to get the number player typed, the money he bet, but instad of that, if i bet 2, it says 1, if i bet 10, it says 2, if i bet 100, it says 3. It's saying the ammount of numbers, instead of the number i entered.
Any clue why?
pawn Код:
if(dialogid == DIALOG_BET5)
{
if(strlen(inputtext) >= 1)
{
PokerCardsInfo[Pot] = PokerCardsInfo[Pot]+strlen(inputtext);
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
new string[128];
format(string, sizeof(string), "%s has bet %d", Name, strlen(inputtext));
ProxDetector(10.0, playerid, string, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
if(IsPlayerConnected(PokerCardsInfo[P6]))
{
ShowPlayerDialog(PokerCardsInfo[P6], DIALOG_POKER6, DIALOG_STYLE_LIST, "Poker", "Bet\nCheck\nFold", "Continue", "");
}
else
{
new str[128];
format(str, sizeof(str), "Everyone made their bets, the dealer should now /givecards.", Name);
ProxDetector(10.0, playerid, str, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
}
return 1;
}
else
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
new string[128];
format(string, sizeof(string), "%s has bet 0 and is out.", Name);
ProxDetector(10.0, playerid, string, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
PokerCardsInfo[P5] = 500;
PokerPlayerInfo[playerid][Playing] = 0;
if(IsPlayerConnected(PokerCardsInfo[P6]))
{
ShowPlayerDialog(PokerCardsInfo[P6], DIALOG_POKER6, DIALOG_STYLE_LIST, "Poker", "Bet\nCheck\nFold", "Continue", "");
}
else
{
new str[128];
format(str, sizeof(str), "Everyone made their bets, the dealer should now /givecards.", Name);
ProxDetector(10.0, playerid, str, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
}
return 1;
}
}
Ignore the second else.. It's just returning that message temporary.
The problem is really that imput dialog telling the ammount of numbers, and not the number...
Thanks.
Re: Problem in Imput Dialog. -
doreto - 27.07.2012
Try now
pawn Код:
if(dialogid == DIALOG_BET5)
{
if(strlen(inputtext) >= 1)
{
PokerCardsInfo[Pot] = PokerCardsInfo[Pot]+strlen(inputtext);
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
new string[128];
format(string, sizeof(string), "%s has bet %d", Name, inputtext);
ProxDetector(10.0, playerid, string, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
if(IsPlayerConnected(PokerCardsInfo[P6]))
{
ShowPlayerDialog(PokerCardsInfo[P6], DIALOG_POKER6, DIALOG_STYLE_LIST, "Poker", "Bet\nCheck\nFold", "Continue", "");
}
else
{
new str[128];
format(str, sizeof(str), "Everyone made their bets, the dealer should now /givecards.", Name);
ProxDetector(10.0, playerid, str, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
}
return 1;
}
else
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
new string[128];
format(string, sizeof(string), "%s has bet 0 and is out.", Name);
ProxDetector(10.0, playerid, string, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
PokerCardsInfo[P5] = 500;
PokerPlayerInfo[playerid][Playing] = 0;
if(IsPlayerConnected(PokerCardsInfo[P6]))
{
ShowPlayerDialog(PokerCardsInfo[P6], DIALOG_POKER6, DIALOG_STYLE_LIST, "Poker", "Bet\nCheck\nFold", "Continue", "");
}
else
{
new str[128];
format(str, sizeof(str), "Everyone made their bets, the dealer should now /givecards.", Name);
ProxDetector(10.0, playerid, str, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
}
return 1;
}
}
Re: Problem in Imput Dialog. -
Cjgogo - 27.07.2012
It's :
because it's a variable...NOT strlen
pawn Код:
if(dialogid == DIALOG_BET5)
{
if(strval(inputtext) >= 1)
{
PokerCardsInfo[Pot] = PokerCardsInfo[Pot]+strval(inputtext);
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
new string[128];
format(string, sizeof(string), "%s has bet %d", Name, strval(inputtext));
ProxDetector(10.0, playerid, string, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
if(IsPlayerConnected(PokerCardsInfo[P6]))
{
ShowPlayerDialog(PokerCardsInfo[P6], DIALOG_POKER6, DIALOG_STYLE_LIST, "Poker", "Bet\nCheck\nFold", "Continue", "");
}
else
{
new str[128];
format(str, sizeof(str), "Everyone made their bets, the dealer should now /givecards.", Name);
ProxDetector(10.0, playerid, str, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
}
return 1;
}
else
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
new string[128];
format(string, sizeof(string), "%s has bet 0 and is out.", Name);
ProxDetector(10.0, playerid, string, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
PokerCardsInfo[P5] = 500;
PokerPlayerInfo[playerid][Playing] = 0;
if(IsPlayerConnected(PokerCardsInfo[P6]))
{
ShowPlayerDialog(PokerCardsInfo[P6], DIALOG_POKER6, DIALOG_STYLE_LIST, "Poker", "Bet\nCheck\nFold", "Continue", "");
}
else
{
new str[128];
format(str, sizeof(str), "Everyone made their bets, the dealer should now /givecards.", Name);
ProxDetector(10.0, playerid, str, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF);
}
return 1;
}
}
Try that now...:P
Re: Problem in Imput Dialog. -
Tika Spic - 27.07.2012
use strval(inputtext) instead of strlen(inputtext) thats it..
Re : Problem in Imput Dialog. -
ricardo178 - 27.07.2012
It works now. Thank you very much.