AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   array must be indexed (https://forums.alliedmods.net/showthread.php?t=93126)

h4r4ld 05-24-2009 18:03

array must be indexed
 
Hi guys,

I'm quiet new to AMX Scripting, so I tried to start with mixing up some scripts I found here to get a bit into business.

So, heres the code:
Code:

deletei(text[], const what[])
{
      new pos
      new len
      new i
      pos = containi(text, what)
      while (pos>=0)
    {
          len = strlen(what)
          i = 0
          while (text[pos+len+i]!=0)
        {
                text[pos+i] = text[pos+len+i]
                  i++
          }
          text[pos+i] = 0
          pos = containi(text, what)
      }
}

cant_use_tag(id)
{
    if(get_cvar_num("amx_tagprotect") == 0)
    return PLUGIN_CONTINUE
    if(get_cvar_num("amx_taginfront") == 1)
    {
        new name[32]
        get_user_name(id, name, 31)
        new authid[32]
        get_user_authid(id,authid,31)
#if defined CLANTAGD
log_message("[StammiTAG] Authenticating tag: ^"%s^" steamID: ^"%s^"",clantag,authid)
#endif
        if ( (equal(authid,"STEAM_ID_PENDING")) || (equal(authid,"")) )
        {
            set_task(0.5,"admin_entered",id)
            return false
        }
        for (new i=0; i<num_clantags; ++i)
        {
            if ( containi(name, clantaglist[i]) && (equal(authid, authids[i])))
                return false
        }
#if defined CLANTAGD
log_message("[StammiTAG] Authorized tag: ^"%s^" steamID: ^"%s^"",name,authid)
#endif
        for (new m=0; m<num_clantags; ++m)
        {
            if( (containi(name, clantaglist[m])<0) && (equal(authid, authids[m])))
            {
                copy(name,23,name)
                client_cmd(id,"name ^"%s%s^"",clantaglist[m],name)
            }
            return false
        }
#if defined CLANTAGD
log_message("[StammiTAG] Authorized tag: ^"%s^" steamID: ^"%s^"",name,authid)
#endif 
        for (new f=0; f<num_clantags; ++f)
        {
            if( ( containi(name, clantaglist[f]>=0)) && (!equal(authid, authids[f])))
            {
                deletei(name, clantaglist[f])
                trim(name)
                if(strlen(name) == 0)
                {
                    copy(name, 7, "Player")
                }
                client_cmd(id, "name ^"%s^"", name)
            }
#if defined CLANTAGD
log_message("[StammiTAG] Unauthorized tag - Tag deleted: ^"%s^" steamID: ^"%s^"",name,authid)
#endif         
           
            return PLUGIN_CONTINUE
        }
    return true
    }
}

And the compiler tells there is a problem in line 132
phpaTghvm.sma(132) : error 033: array must be indexed (variable "clantaglist")
Code:

for (new f=0; f<num_clantags; ++f)
        {
            if( ( containi(name, clantaglist[f]>=0)) && (!equal(authid, authids[f])))
            {
                deletei(name, clantaglist[f])
                trim(name)
                if(strlen(name) == 0)
                {
                    copy(name, 7, "Player")
                }
                client_cmd(id, "name ^"%s^"", name)
            }

*edit: Its the if

I hope someone will help and have a little explaintation would be nice. ;)
Thanks a lot

Exolent[jNr] 05-24-2009 18:17

Re: array must be indexed
 
Show the full code.

h4r4ld 05-24-2009 18:19

Re: array must be indexed
 
Quote:

Originally Posted by Exolent[jNr] (Post 833985)
Show the full code.


Not nessesary, I fixed myself, but thanks anyway.

Close pls :)


All times are GMT -4. The time now is 01:30.

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