28.08.2012, 13:05
Hello i have a problem with the following code:
i have some bugs soz if they are stupid mistakes i never really work with inputtext.
well for one i can enter a letter in the dialog without it displaying
second if i have say 12 $ in the bank account and i withdraw 2$ it will say a random number say 49 was withdrawed but then will display the correct balence
pawn Код:
if(dialogid == DIALOG_WITHDRAW)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, DIALOG_WITHDRAW, DIALOG_STYLE_INPUT, "Choose your value", "Please input a number in which you want to withdraw.\nPlease input a value!", "Ok", "Cancel");
}
new string[128];
if(PlayerInfo[playerid][Pbank] < strlen(inputtext))
{
SendClientMessage(playerid, COLOR_RED, "Sorry, you dont have this much cash");
return 1;
}
else if(strlen(inputtext) < 0 || strlen(inputtext) > 1000000)
{
SendClientMessage(playerid, COLOR_RED, "Only number values and it has to be more than 0 and less than 1 million");
return 1;
}
else if(PlayerInfo[playerid][Pbank] >=strlen(inputtext))
{
GivePlayerMoney(playerid, strlen(inputtext));
PlayerInfo[playerid][Pbank] -=strlen(inputtext);
format(string, sizeof(string), "Thank you for using san fierro bank.\nYou have withdrawn $%i from your bank account.\nYour bank balence now stands at $%i", strlen(inputtext), PlayerInfo[playerid][Pbank]);
ShowPlayerDialog(playerid, 1939, DIALOG_STYLE_MSGBOX, "Withdraw statment", string, "Ok", "Close");
return 1;
}
}
well for one i can enter a letter in the dialog without it displaying
Quote:
Only number values and it has to be more than 0 and less than 1 million |