SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 15/05/2010, 01:54 PM   #1
DarkPower
Gangsta
 
DarkPower's Avatar
 
Join Date: Feb 2010
Posts: 675
Reputation: 7
Default error 033: array must be indexed (variable

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


1 Error.


pawn Code:
new stringk[128];
     dini_IntSet(file,"Banka",strlen(inputtext));
     format(stringk, sizeof stringk, "%d", strlen(inputtext));
     PlayerInfo[playerid][Banka] +=stringk;

LINE:
Code:
PlayerInfo[playerid][Banka] +=stringk;
can you help me....

i was try PlayerInfo[playerid][Banka] +=[stringk];
but didint work
DarkPower is offline  
Old 15/05/2010, 01:56 PM   #2
juice.j
Huge Clucker
 
Join Date: May 2010
Posts: 218
Reputation: 0
Default Re: error 033: array must be indexed (variable

You cannot add a string to an integer .

Use strvalEx(stringk) to convert the string to an integer.
__________________
SA:MP Freelancer Portfolio:

GameMode / Filterscript / Plugin Development via
- PAWN / C/C++
- Database (mySQL) & Filebased - Systems

Webdevelopment / Interfaces Webapplications - SA:MP Server via
- HTML & CSS
- PHP, JavaScript, Ajax

Interested in a unique, high quality gamemode using modern code and c++-plugins? A control panel giving you the opportunity to do literally everything on your server from a browser?

Contact Info: juice.j.122@hotmail.com
juice.j is offline  
Old 15/05/2010, 02:00 PM   #3
DarkPower
Gangsta
 
DarkPower's Avatar
 
Join Date: Feb 2010
Posts: 675
Reputation: 7
Default Re: error 033: array must be indexed (variable

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 Code:
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...?
DarkPower is offline  
Old 15/05/2010, 02:06 PM   #4
juice.j
Huge Clucker
 
Join Date: May 2010
Posts: 218
Reputation: 0
Default Re: error 033: array must be indexed (variable

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:

Code:
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:

Code:
if(strvalEx(inputtext)>0){   // little check so no one enters negative numbers
   PlayerInfo[playerid][Banka]+=strvalEx(inputtext);
}
__________________
SA:MP Freelancer Portfolio:

GameMode / Filterscript / Plugin Development via
- PAWN / C/C++
- Database (mySQL) & Filebased - Systems

Webdevelopment / Interfaces Webapplications - SA:MP Server via
- HTML & CSS
- PHP, JavaScript, Ajax

Interested in a unique, high quality gamemode using modern code and c++-plugins? A control panel giving you the opportunity to do literally everything on your server from a browser?

Contact Info: juice.j.122@hotmail.com
juice.j is offline  
Old 15/05/2010, 02:08 PM   #5
DarkPower
Gangsta
 
DarkPower's Avatar
 
Join Date: Feb 2010
Posts: 675
Reputation: 7
Default Re: error 033: array must be indexed (variable



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]
DarkPower is offline  
Old 15/05/2010, 02:17 PM   #6
juice.j
Huge Clucker
 
Join Date: May 2010
Posts: 218
Reputation: 0
Default Re: error 033: array must be indexed (variable

Check my posting above.
__________________
SA:MP Freelancer Portfolio:

GameMode / Filterscript / Plugin Development via
- PAWN / C/C++
- Database (mySQL) & Filebased - Systems

Webdevelopment / Interfaces Webapplications - SA:MP Server via
- HTML & CSS
- PHP, JavaScript, Ajax

Interested in a unique, high quality gamemode using modern code and c++-plugins? A control panel giving you the opportunity to do literally everything on your server from a browser?

Contact Info: juice.j.122@hotmail.com
juice.j is offline  
Old 15/05/2010, 02:18 PM   #7
DarkPower
Gangsta
 
DarkPower's Avatar
 
Join Date: Feb 2010
Posts: 675
Reputation: 7
Default Re: error 033: array must be indexed (variable

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Checkpoint & error 033: array must be indexed (variable "tmp") KyleOwnzYou Help Archive 2 08/05/2010 04:10 AM
error 033: array must be indexed (variable "Address") KyleSmith Help Archive 1 16/02/2010 12:59 AM
[Help]error 033: array must be indexed (variable "teleport") borisblat Help Archive 1 13/10/2009 02:51 PM
error 033: array must be indexed (variable "dini_Get") introzen Help Archive 3 09/03/2009 06:55 AM


All times are GMT. The time now is 04:37 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.