Raised This Month: $128 Target: $400
 32% 

Solved error 001: expected token: "]", but found "-identifier-"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kww
Junior Member
Join Date: Feb 2021
Location: Russia
Old 02-19-2021 , 09:02   error 001: expected token: "]", but found "-identifier-"
Reply With Quote #1

Hello coders! I'm trying to make message from rows defined in array, but getting error 001: expected token: "]", but found "-identifier-".
Can someone help me to fix it?
Here's problem code:
PHP Code:
new const BHP2_HEADER[] = "^n* Possible arguments:^n"
new const BHP2_HELP[][128] = {
    
"* help - show this message^n",
    
"* toggle - toggle bhop^n",
    
"* autojump <1 | 0> - toggle autojump^n",
    
"* list - show bhop users list^n" }
new const 
BHP2_FOOTER[] = "***"

new xbh_help_msg[1024]

public 
xbhop_help(id)
{
    new 
i
    format
(xbh_help_msgcharsmax(xbh_help_msg), "%s"BHP2_HEADER)
    
    for(
i=03i++)
    {
        
// PROMBLEM CODE IS BELOW
        
add(xbh_help_msgcharsmax(xbh_help_msg), BHP2_HELP[i], charsmax(BHP2_HELP[i])) //ERROR COMES HERE
        // PROMBLEM CODE IS ABOVE
    
}
    
    
add(xbh_help_msgcharsmax(xbh_help_msg), BHP2_FOOTERcharsmax(BHP2_FOOTER))

    
client_print(idprint_consolexbh_help_msg)
    
    return 
PLUGIN_HANDLED


Last edited by kww; 02-20-2021 at 07:24.
kww is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-19-2021 , 10:07   Re: error 001
Reply With Quote #2

charsmax(BHP2_HELP[i]) charsmax(BHP2_HELP[])
__________________
@Jailbreak Main Mod v2.6 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
kww
Junior Member
Join Date: Feb 2021
Location: Russia
Old 02-19-2021 , 15:01   Re: error 001
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
charsmax(BHP2_HELP[i]) charsmax(BHP2_HELP[])
It won't work
kww is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-19-2021 , 15:04   Re: error 001: expected token: "]", but found "-identifier-"
Reply With Quote #4

If that didn't work then maybe you have the issue elsewhere or you forgot to save your file with the fix before recompiling (I've done that before).
__________________
fysiks is offline
kww
Junior Member
Join Date: Feb 2021
Location: Russia
Old 02-19-2021 , 15:35   Re: error 001: expected token: "]", but found "-identifier-"
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
If that didn't work then maybe you have the issue elsewhere or you forgot to save your file with the fix before recompiling (I've done that before).
I compiled and now it says: "error 029: invalid expression, assumed zero" on the same line
kww is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-20-2021 , 05:17   Re: error 001: expected token: "]", but found "-identifier-"
Reply With Quote #6

It compiles for me just by making the change mentioned by Natsheh. I've never actually used a fourth argument for add(). Since you're wanting to add the whole string, simply only putting only three arguments should work.
__________________

Last edited by fysiks; 02-20-2021 at 05:18.
fysiks is offline
kww
Junior Member
Join Date: Feb 2021
Location: Russia
Old 02-20-2021 , 07:24   Re: error 001: expected token: "]", but found "-identifier-"
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
It compiles for me just by making the change mentioned by Natsheh. I've never actually used a fourth argument for add(). Since you're wanting to add the whole string, simply only putting only three arguments should work.
Okay. I deleted 4th arg and it compiled. Thanks
kww 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 14:59.


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