case atm_withdraw:
{
if (!response) return 1;
if(response)
{
if (inputtext[256] == 0)
if (inputtext[256] < 0)
if (PlayerInfo[playerid][pBankMoney] >= inputtext[256])
{
GivePlayerMoney(playerid, inputtext[256]);
PlayerInfo[playerid][pBankMoney] -= inputtext[256];
}
else
{
return 1;
}
}
}
case atm_withdraw:
{
if (!response) return 1;
if(response)
{
if (inputtext[256] == 0)
{
return 1;
}
else if (inputtext[256] < 0)
{
return 1;
}
else
{
if (PlayerInfo[playerid][pBankMoney] >= inputtext[256])
{
GivePlayerMoney(playerid, inputtext[256]);
PlayerInfo[playerid][pBankMoney] -= inputtext[256];
}
}
}
}
inputtext[256]
case atm_withdraw:
{
if (!response)
return 1;
// no need to check also if(response) because if(!response) already stopped the code returning 1.
new inputvalue; // we create an integer variable
inputvalue = strval(inputtext); // we set its value to the integer value of the string "inputtext"
// inputtext[256] is wrong, we will now use inputvalue
if (inputvalue <= 0) // <= means less than or equal to (similarly you can use >=)
return 1;
// again, no need for an else {} block here, because if inputvalue <= 0 then the code stops there
if (PlayerInfo[playerid][pBankMoney] >= inputvalue)
{
GivePlayerMoney(playerid, inputvalue);
PlayerInfo[playerid][pBankMoney] -= inputvalue;
}
}
if (inputvalue <= 0) // <= means less than or equal to (similarly you can use >=)
return 1;
|
Hello, by doing this:
PHP код:
Please see Strval. In your case: PHP код:
|