error 033: array must be indexed (variable "inputtext")
#1

Code:
new value;
0.4 * inputtext = value; // ERROR
GivePlayerMoney(playerid, value);
Reply
#2

Write it like this:

Code:
new value = 0.4 * strval(inputtext); // ERROR
GivePlayerMoney(playerid, value);
Greekz
Reply
#3

Tag mistmatch
Code:
new value = 0.4 * strval(inputtext);
Reply
#4

pawn Code:
new value;
value = 0.4 * strval(inputtext);
Reply
#5

Thanks all REP++
Reply
#6

hm.. It doesn't work. If i type 6 it shows 12904821094 and give me 1293031 money

Code:
new hh[128], value;
value = strval(inputtext) * 0.4;   <=== TAG MISMATCH
GivePlayerMoney(playerid, value);
Still tag mismatch.
Reply
#7

pawn Code:
new Float:value = strval(inputtext) * 0.4;
    GivePlayerMoney(playerid, floatround(value, floatround_round));
References:
https://sampwiki.blast.hk/wiki/Floatround
https://sampwiki.blast.hk/wiki/Floats

EDIT:

I would also recommend that you set a limit on what a player can enter. To make sure they don't enter negative or very high positive values such as -194581371489144 and 19478189587175 for instance.
Example:
pawn Code:
if(!(1 <= strval(inputtext) <= 999999999)) return SendClientMessage(playerid, -1, "You must put a value between 1 and 999999999.");
Reply
#8

I've already have limit:

Code:
if(strval(inputtext) >= 100 || strval(inputtext) <= 700)
Reply
#9

Yep. Now i fixed it and working. Thanks again REP++.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)