get amount onplayertext
#1

im trying to make deposit for bank, and am trying to use onplayertext for the amount part, something kind of like:

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(TestList[playerid] == 1)
    {
        new amount = strlen(text);
        new String[50];

        format(String, sizeof(String), "Amount = %i", amount);
        SendClientMessage(playerid, 0xE60000FF, String);

            TestList[playerid] = 0;
        return 0;
    }
    return 1;
}
the problem is the "amount" = how many characters there are, not the actual amount you entered. like 1234 = 4 instead of 1234.

so if you wanted to deposit $500 and enter "500", it say 3 instead because its 3 char..

i searched but cant find how to get the amount.

i hope i make myself clear, please help.
Reply
#2

that's strlen(const string[]);
this funciton returns the number of symbols used in a string
Reply
#3

strval?
Reply
#4

no, you don't want it to return the number inputed, but the number of characters, right?
for example
new str[8]="1234567";
strval(str) = 1234567;
strlen(str) = 7;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)