AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved error 001: expected token: "]", but found "-identifier-" (https://forums.alliedmods.net/showthread.php?t=330753)

kww 02-19-2021 08:02

error 001: expected token: "]", but found "-identifier-"
 
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



Natsheh 02-19-2021 09:07

Re: error 001
 
charsmax(BHP2_HELP[i]) :arrow: charsmax(BHP2_HELP[])

kww 02-19-2021 14:01

Re: error 001
 
Quote:

Originally Posted by Natsheh (Post 2737492)
charsmax(BHP2_HELP[i]) :arrow: charsmax(BHP2_HELP[])

It won't work

fysiks 02-19-2021 14:04

Re: error 001: expected token: "]", but found "-identifier-"
 
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).

kww 02-19-2021 14:35

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

Originally Posted by fysiks (Post 2737533)
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

fysiks 02-20-2021 04:17

Re: error 001: expected token: "]", but found "-identifier-"
 
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.

kww 02-20-2021 06:24

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

Originally Posted by fysiks (Post 2737555)
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


All times are GMT -4. The time now is 18:14.

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