Raised This Month: $ Target: $400
 0% 

Can not understand how to fix error 033: array must be indexed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 07-06-2013 , 05:05   Can not understand how to fix error 033: array must be indexed
Reply With Quote #1

Here's a part of code on say hook, i've just checked current variable of setinfo 'translit' and then if it's 0 i set to 1, if it's 1 i set to 0.

PHP Code:
    else if(containi(say_args"/lang") != -)
    {
        
get_user_info(id,"translit",lang,2)
        if(
lang == 0
            
set_user_info(id,"translit","1");
        else if(
lang == 1
            
set_user_info(id,"translit","0");
        return 
PLUGIN_HANDLED
    

But it returns an error:
PHP Code:
error 033: array must be indexed (variable "lang"
Please help me - how to fix? What's wrong there?
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-06-2013 , 05:16   Re: Can not understand how to fix error 033: array must be indexed
Reply With Quote #2

lang variable must be a string.
__________________
Arkshine is offline
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 07-06-2013 , 05:19   Re: Can not understand how to fix error 033: array must be indexed
Reply With Quote #3

Quote:
Originally Posted by Arkshine View Post
lang variable must be a string.
How to do that?

I have this
PHP Code:
static lang[2
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-06-2013 , 05:31   Re: Can not understand how to fix error 033: array must be indexed
Reply With Quote #4

Misread. You have to convert "lang" to an integer, like str_to_num( lang ), or if contain only 0 or 1, you could also checking like "lang[0] == '1'" ;
__________________
Arkshine is offline
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 07-06-2013 , 05:44   Re: Can not understand how to fix error 033: array must be indexed
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
Misread. You have to convert "lang" to an integer, like str_to_num( lang ), or if contain only 0 or 1, you could also checking like "lang[0] == '1'" ;
thx. lang[0] looks easier =)
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-06-2013 , 14:51   Re: Can not understand how to fix error 033: array must be indexed
Reply With Quote #6

Quote:
Originally Posted by Mofforg View Post
thx. lang[0] looks easier =)
But realize that this only works when it is a single digit.
__________________
fysiks is offline
Reply


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

Forum Jump


All times are GMT -4. The time now is 06:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode