SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 01/07/2016, 03:25 PM   #1
Alpay0098
Huge Clucker
 
Alpay0098's Avatar
 
Join Date: Oct 2014
Location: Behind ya :o
Posts: 287
Reputation: 20
Default This error

PHP Code:
            if(listitem == 0)
            {
                new 
stringad[100];
                foreach(
Playeri)
                {
                    if(
PlayerInfo[pAdvert] != "None"// Error line
                    
{
                        
format(stringadsizeof(string), "%s | Contact: %i\n",PlayerInfo[pAdvert], PlayerInfo[pPnumber]);
                    }
                    else
                    {
                        
format(stringadsizeof(string), "No Advertisement Yet");
                    }
                }
                
ShowPlayerDialog(playeridDIALOG_ADLISTDIALOG_STYLE_LIST"Advertisement List"stringad"Select""Cancel");
            } 
The error:
PHP Code:
error 033: array must be indexed (variable "-unknown-"
__________________
My works :
  • [FilterScript] Reconnect System Removed due to some reasons. P.M. me if you want it.
Alpay0098 is offline   Reply With Quote
Old 01/07/2016, 03:48 PM   #2
DTV
Banned
 
Join Date: Dec 2010
Posts: 547
Reputation: 125
Default Re: This error

sizeof(string) should be sizeof(stringad), but can you show where you declare PlayerInfo?
DTV is offline   Reply With Quote
Old 01/07/2016, 04:36 PM   #3
Alpay0098
Huge Clucker
 
Alpay0098's Avatar
 
Join Date: Oct 2014
Location: Behind ya :o
Posts: 287
Reputation: 20
Default Re: This error

Quote:
Originally Posted by DTV View Post
sizeof(string) should be sizeof(stringad), but can you show where you declare PlayerInfo?
I already did that - It's just a simple enum that PlayerInfo[playerid][pAdvert] is defined like below:
PHP Code:
pAdvert[128
__________________
My works :
  • [FilterScript] Reconnect System Removed due to some reasons. P.M. me if you want it.
Alpay0098 is offline   Reply With Quote
Old 01/07/2016, 04:47 PM   #4
DTV
Banned
 
Join Date: Dec 2010
Posts: 547
Reputation: 125
Default Re: This error

Then write it as PlayerInfo[i][pAdvert] since you're looping through all the players, same with pNumber.
DTV is offline   Reply With Quote
Old 02/07/2016, 07:45 AM   #5
Alpay0098
Huge Clucker
 
Alpay0098's Avatar
 
Join Date: Oct 2014
Location: Behind ya :o
Posts: 287
Reputation: 20
Default Re: This error

Dude I already did that but still gives the error
PHP Code:
if(PlayerInfo[i][pAdvert] != "None"
Is there anything wrong with this
__________________
My works :
  • [FilterScript] Reconnect System Removed due to some reasons. P.M. me if you want it.
Alpay0098 is offline   Reply With Quote
Old 02/07/2016, 07:47 AM   #6
SyS
High-roller
 
SyS's Avatar
 
Join Date: Oct 2015
Posts: 1,939
Reputation: 504
Default Re: This error

Quote:
Originally Posted by Alpay0098 View Post
Dude I already did that but still gives the error
PHP Code:
if(PlayerInfo[i][pAdvert] != "None"
Is there anything wrong with this
yes it have you cant compare strings like that use strcmp
SyS is offline   Reply With Quote
Old 02/07/2016, 09:17 AM   #7
VincenzoDrift
Little Clucker
 
VincenzoDrift's Avatar
 
Join Date: Jun 2014
Posts: 47
Reputation: 3
Default Re: This error

Delete this.
Quote:
if(PlayerInfo[pAdvert] != "None") // Error line
Write this.
Code:
if(!strcmp(PlayerInfo[pAdvert], "None", false, 128))

Read this
http://wiki.sa-mp.com/wiki/Strcmp
__________________
Sorry for my bad english
VincenzoDrift is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 017: undefined symbol,fatal error 107: too many error messages on one line Slicebook Scripting Help 11 04/05/2014 08:30 PM
An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds.... rati555 Scripting Help 1 14/09/2012 07:45 PM
Registered plate stock error 'error 076: syntax error in the expression, or invalid function call' Deal-or-die Scripting Help 2 25/06/2012 03:12 PM
Error message: : error 030: compound statement not closed at the end of file (started at line 503) David5290 Scripting Help 5 13/04/2012 03:50 AM
I get tagmismatch error, But i cant find any error error Swiftz Help Archive 1 16/04/2011 04:31 AM


All times are GMT. The time now is 03:24 PM.


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