Raised This Month: $ Target: $400
 0% 

Help Error: Expected token: "}", but found "-string-" on line 45


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PawnBegg
Junior Member
Join Date: Apr 2022
Old 05-03-2022 , 07:18   Re: Help Error: Expected token: "}", but found "-string-" on line 45
Reply With Quote #1

Code:
 #include <amxmodx>
#include <amxmisc>

#define PLUGIN            "ULTIMATE WHO"
#define VERSION            "1.1"
#define AUTHOR            "P.Of.Pw"

#define CharsMax(%1)        sizeof %1 - 1
#define time_shower        1.0

#define GROUPS_NAME        13
#define GROUPS_ACCESS        15

#define motd_msg        "Admin's Online"

new color[][] =
{
    "FF0000",
    "66FF00",
    "FF9900",
    "33FF33",
    "CC3333",
    "3300CC",
    "330066",
    "006699",
    "CCFF00",
    "FF0099",
    "FF3300",
    "FF6633",
    "FFCC99",
    "3399CC",
    "663366"
}
new GroupNames[GROUPS_NAME][] =
{
    "---=== Detinator ===---",
    "---=== Owner+Vip ===---",
    "---=== Owner ===---",
    "---=== Co-Owner+Vip ===---",
    "---=== Co-Owner ===---",
    "---=== God+Vip ===---",
    "---=== God ===---",
    "---=== Moderator+Vip ===---",
    "---=== Moderator ===---",
    "---=== Helper+Vip ===---",
    "---=== Helper ===---",
    "---=== Slot ===---",
    "---=== Vip ===---"
};

new GroupFlags[GROUPS_ACCESS][] = 
{
    "abcdefghijklmnopqrstu",
    "bcdefghijklmnopqrstu",
    "bdefghijklmnopqrsu",
    "bcdefghijklmnopqrst",
    "bdefghijklmnopqrs",
    "bcdefghijlmnopqrst",
    "bdefghijlmnopqrs",
    "bcdefgijlmnopqrt",
    "bdefgijlmnopqr",
    "bdefgijmnop",
    "bcdefgijmnopt",
    "bcdefgijmnot",
    "bdefgijmno",
    "b",
    "ct"
};

new GroupFlagsValue[GROUPS_NAME]

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    for(new p_of_pw = 0 ; p_of_pw < GROUPS_NAME ; p_of_pw++)
        GroupFlagsValue[p_of_pw] = read_flags(GroupFlags[p_of_pw])
   
    register_clcmd("say", "cmdSay")
    register_clcmd("say_team", "cmdSay")
}

public cmdSay(id)
{
    new say[8]
    read_args(say, 7)
    
    if ((containi(say, "who") != -1 
    || containi(say, "admin") != -1 
    || containi(say, "admins") != -1  
    || contain(say, "/who") != -1 
    || contain(say, "/admin") != -1 
    || contain(say, "/admins") != -1))
        who_motd(id)
    
    return PLUGIN_CONTINUE
}

who_motd(id)
{
    new sPlayers[32], iNum, iPlayer
    new sName[32], sBuffer[1024]
    new iLen
    
    iLen = formatex(sBuffer, sizeof sBuffer - 1, "<body bgcolor=#000000><font color=#7b68ee><pre>")
   
    get_players(sPlayers, iNum, "ch")
   
    for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
    {   
        iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h5><font color=^"violet^">%s^n</font></h5></center>", GroupNames[p_of_pw])
     
        for(new a = 0; a < iNum ; a++)
        {   
            iPlayer = sPlayers[a]
         
            if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
            {
                get_user_name(iPlayer, sName, sizeof sName - 1)
                iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><font color=^"%s^">%s^n</center></font>", color[p_of_pw], sName)
            }
        }        
    }
    
    show_motd(id, sBuffer, motd_msg)
    return PLUGIN_CONTINUE
}
First of all you missed "---=== Moderator ===---", <- [,]
Secondly you defined #define GROUPS_NAME 15, but you have only 13 GROUP_NAME.

It compiling without errors now but you must modify GROUPS_ACCESS cuz you define 15 of them but you have only 13 GROUP_NAME.
PawnBegg is offline
Colombinus
Junior Member
Join Date: Nov 2020
Old 05-03-2022 , 08:32   Re: Help Error: Expected token: "}", but found "-string-" on line 45
Reply With Quote #2

Quote:
Originally Posted by PawnBegg View Post
Code:
 #include <amxmodx>
#include <amxmisc>

#define PLUGIN            "ULTIMATE WHO"
#define VERSION            "1.1"
#define AUTHOR            "P.Of.Pw"

#define CharsMax(%1)        sizeof %1 - 1
#define time_shower        1.0

#define GROUPS_NAME        13
#define GROUPS_ACCESS        15

#define motd_msg        "Admin's Online"

new color[][] =
{
    "FF0000",
    "66FF00",
    "FF9900",
    "33FF33",
    "CC3333",
    "3300CC",
    "330066",
    "006699",
    "CCFF00",
    "FF0099",
    "FF3300",
    "FF6633",
    "FFCC99",
    "3399CC",
    "663366"
}
new GroupNames[GROUPS_NAME][] =
{
    "---=== Detinator ===---",
    "---=== Owner+Vip ===---",
    "---=== Owner ===---",
    "---=== Co-Owner+Vip ===---",
    "---=== Co-Owner ===---",
    "---=== God+Vip ===---",
    "---=== God ===---",
    "---=== Moderator+Vip ===---",
    "---=== Moderator ===---",
    "---=== Helper+Vip ===---",
    "---=== Helper ===---",
    "---=== Slot ===---",
    "---=== Vip ===---"
};

new GroupFlags[GROUPS_ACCESS][] = 
{
    "abcdefghijklmnopqrstu",
    "bcdefghijklmnopqrstu",
    "bdefghijklmnopqrsu",
    "bcdefghijklmnopqrst",
    "bdefghijklmnopqrs",
    "bcdefghijlmnopqrst",
    "bdefghijlmnopqrs",
    "bcdefgijlmnopqrt",
    "bdefgijlmnopqr",
    "bdefgijmnop",
    "bcdefgijmnopt",
    "bcdefgijmnot",
    "bdefgijmno",
    "b",
    "ct"
};

new GroupFlagsValue[GROUPS_NAME]

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    for(new p_of_pw = 0 ; p_of_pw < GROUPS_NAME ; p_of_pw++)
        GroupFlagsValue[p_of_pw] = read_flags(GroupFlags[p_of_pw])
   
    register_clcmd("say", "cmdSay")
    register_clcmd("say_team", "cmdSay")
}

public cmdSay(id)
{
    new say[8]
    read_args(say, 7)
    
    if ((containi(say, "who") != -1 
    || containi(say, "admin") != -1 
    || containi(say, "admins") != -1  
    || contain(say, "/who") != -1 
    || contain(say, "/admin") != -1 
    || contain(say, "/admins") != -1))
        who_motd(id)
    
    return PLUGIN_CONTINUE
}

who_motd(id)
{
    new sPlayers[32], iNum, iPlayer
    new sName[32], sBuffer[1024]
    new iLen
    
    iLen = formatex(sBuffer, sizeof sBuffer - 1, "<body bgcolor=#000000><font color=#7b68ee><pre>")
   
    get_players(sPlayers, iNum, "ch")
   
    for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
    {   
        iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h5><font color=^"violet^">%s^n</font></h5></center>", GroupNames[p_of_pw])
     
        for(new a = 0; a < iNum ; a++)
        {   
            iPlayer = sPlayers[a]
         
            if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
            {
                get_user_name(iPlayer, sName, sizeof sName - 1)
                iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><font color=^"%s^">%s^n</center></font>", color[p_of_pw], sName)
            }
        }        
    }
    
    show_motd(id, sBuffer, motd_msg)
    return PLUGIN_CONTINUE
}
First of all you missed "---=== Moderator ===---", <- [,]
Secondly you defined #define GROUPS_NAME 15, but you have only 13 GROUP_NAME.

It compiling without errors now but you must modify GROUPS_ACCESS cuz you define 15 of them but you have only 13 GROUP_NAME.
I already added two other names but it tells me

Error: Initialization data exceeds declared size on line 48

And

Error: Invalid function or declaration on line 51

Code:
 #include <amxmodx>
#include <amxmisc>

#define PLUGIN            "ULTIMATE WHO"
#define VERSION            "1.1"
#define AUTHOR            "P.Of.Pw"

#define CharsMax(%1)        sizeof %1 - 1
#define time_shower        1.0

#define GROUPS_NAME        13
#define GROUPS_ACCESS        15

#define motd_msg        "Admin's Online"

new color[][] =
{
    "FF0000",
    "66FF00",
    "FF9900",
    "33FF33",
    "CC3333",
    "3300CC",
    "330066",
    "006699",
    "CCFF00",
    "FF0099",
    "FF3300",
    "FF6633",
    "FFCC99",
    "3399CC",
    "663366"
}
new GroupNames[GROUPS_NAME][] =
{
    "---=== Detinator ===---",
    "---=== Owner+Vip ===---",
    "---=== Owner ===---",
    "---=== Co-Owner+Vip ===---",
    "---=== Co-Owner ===---",
    "---=== God+Vip ===---",
    "---=== God ===---",
    "---=== Moderator+Vip ===---",
    "---=== Moderator ===---",
    "---=== Admin+Vip===---",
    "---=== Admin ===---",
    "---=== Helper+Vip ===---",
    "---=== Helper ===---",
    "---=== Slot ===---",
    "---=== Vip ===---"
};

new GroupFlags[GROUPS_ACCESS][] = 
{
    "abcdefghijklmnopqrstu",
    "bcdefghijklmnopqrstu",
    "bdefghijklmnopqrsu",
    "bcdefghijklmnopqrst",
    "bdefghijklmnopqrs",
    "bcdefghijlmnopqrst",
    "bdefghijlmnopqrs",
    "bcdefgijlmnopqrt",
    "bdefgijlmnopqr",
    "bdefgijmnop",
    "bcdefgijmnopt",
    "bcdefgijmnot",
    "bdefgijmno",
    "b",
    "ct"
};

new GroupFlagsValue[GROUPS_NAME]

public plugin_init() 
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    for(new p_of_pw = 0 ; p_of_pw < GROUPS_NAME ; p_of_pw++)
        GroupFlagsValue[p_of_pw] = read_flags(GroupFlags[p_of_pw])
   
    register_clcmd("say", "cmdSay")
    register_clcmd("say_team", "cmdSay")
}

public cmdSay(id)
{
    new say[8]
    read_args(say, 7)
    
    if ((containi(say, "who") != -1 
    || containi(say, "admin") != -1 
    || containi(say, "admins") != -1  
    || contain(say, "/who") != -1 
    || contain(say, "/admin") != -1 
    || contain(say, "/admins") != -1))
        who_motd(id)
    
    return PLUGIN_CONTINUE
}

who_motd(id)
{
    new sPlayers[32], iNum, iPlayer
    new sName[32], sBuffer[1024]
    new iLen
    
    iLen = formatex(sBuffer, sizeof sBuffer - 1, "<body bgcolor=#000000><font color=#7b68ee><pre>")
   
    get_players(sPlayers, iNum, "ch")
   
    for(new p_of_pw = 0; p_of_pw < GROUPS_NAME ; p_of_pw++)
    {   
        iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><h5><font color=^"violet^">%s^n</font></h5></center>", GroupNames[p_of_pw])
     
        for(new a = 0; a < iNum ; a++)
        {   
            iPlayer = sPlayers[a]
         
            if(get_user_flags(iPlayer) == GroupFlagsValue[p_of_pw])
            {
                get_user_name(iPlayer, sName, sizeof sName - 1)
                iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen, "<center><font color=^"%s^">%s^n</center></font>", color[p_of_pw], sName)
            }
        }        
    }
    
    show_motd(id, sBuffer, motd_msg)
    return PLUGIN_CONTINUE
}

Last edited by Colombinus; 05-03-2022 at 08:33.
Colombinus is offline
Reply



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 10:32.


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