error 033: array must be indexed (variable
#1

C:\Users\NASTIE\Desktop\BankSystem\filterscripts\B anSystem.pwn(121) : error 033: array must be indexed (variable "stringk")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


pawn Код:
new stringk[128];
     dini_IntSet(file,"Banka",strlen(inputtext));
     format(stringk, sizeof stringk, "%d", strlen(inputtext));
     PlayerInfo[playerid][Banka] +=stringk;
LINE:
Код:
PlayerInfo[playerid][Banka] +=stringk;
can you help me....

i was try PlayerInfo[playerid][Banka] +=[stringk];
but didint work
Reply
#2

You cannot add a string to an integer .

Use strvalEx(stringk) to convert the string to an integer.
Reply
#3

Can you help me beause i dont understand what you wanna to say, i trying to make bank system whitout register/login and now i try to make /deposit command whit dialog and now i need help how to update, here are hole OnDialogRespone
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if(dialogid == 2000)
    {
        if(response)
        {
          new file[128];
        new string[128];
      new name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, sizeof(name));
            if(strlen(inputtext) == 0)
            {
            format(string, sizeof string, "Racun: %s\n\nNapisite iznos koji zelite staviti u banku:", name);
            ShowPlayerDialog(playerid, 2000, DIALOG_STYLE_INPUT, "Zagrebacka banka | ExtremePower", string, "Ok", "Odustani");
                return 0;
            }
            format(file,sizeof(file),"%s.ini",name);
            if(fexist(file))
            {
        new stringk[128];
                dini_IntSet(file,"Banka",strlen(inputtext));
                format(stringk, sizeof stringk, "%d", strlen(inputtext));
                PlayerInfo[playerid][Banka] +=stringk;
            }
        }
    }
    return 1;
}
Can you help me...?
Reply
#4

Well I am not too sure about your code as I always have slight problems when reading from an unknown language but in case you are trying to add the number someone enters in the dialog box to "PlayerInfo[playerid][Banka]", simply do:

Код:
new stringk[128];
dini_IntSet(file,"Banka",strlen(inputtext)); // Why do you actually use strlen? Do you really want to use the length of inputtext?
format(stringk, sizeof stringk, "%d", strlen(inputtext));
PlayerInfo[playerid][Banka] +=strvalEx(stringk);
I'm pretty sure tho' that this code is not what you actually want.

Here's a different solution:

Код:
if(strvalEx(inputtext)>0){   // little check so no one enters negative numbers
   PlayerInfo[playerid][Banka]+=strvalEx(inputtext);
}
Reply
#5



And BTW: InputText is money so if you can help me about that, what money type (number) to take from him and put on bank account > PlayerInfo[playerid][Banka]
Reply
#6

Check my posting above.
Reply
#7

tny dude now evrything works fine, now just /withdraw command and i make bank system tny alot man i learn from you today
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)