Raised This Month: $ Target: $400
 0% 

Not an array or to many subscripts


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MokeN
Senior Member
Join Date: Jan 2012
Location: Vaasa, Finland
Old 06-28-2012 , 12:32   Not an array or to many subscripts
Reply With Quote #1

I've never had this error before so that's why i'm asking you guys.
I've googled and searched but didn't found anything about my problem.

Errors:

PHP Code:
error 028invalid subscript not an array or too many subscripts 
Error Line:

PHP Code:
return g_iSimon[get_param(1)]; 
Thanks in advance.
__________________
Private Works:
- Achievements, HNS & JB Menus, HNS & JB Shops

mY BlockMaker - mY Steam - mY Game Menu
MokeN is offline
Send a message via Skype™ to MokeN
MokeN
Senior Member
Join Date: Jan 2012
Location: Vaasa, Finland
Old 06-28-2012 , 12:49   Re: Not an array or to many subscripts
Reply With Quote #2

Well it's a native function linked to another plugin.

PHP Code:
public plugin_natives()
{
    
register_library("jb_simon");
    
    
register_native("jb_is_user_simon""_is_user_simon");    
}
    
public 
_is_user_simon(iPluginiParams)
{

    return 
g_iSimon[get_param(1)];

__________________
Private Works:
- Achievements, HNS & JB Menus, HNS & JB Shops

mY BlockMaker - mY Steam - mY Game Menu
MokeN is offline
Send a message via Skype™ to MokeN
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-28-2012 , 12:54   Re: Not an array or to many subscripts
Reply With Quote #3

Show how g_iSimon is created.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
MokeN
Senior Member
Join Date: Jan 2012
Location: Vaasa, Finland
Old 06-28-2012 , 13:29   Re: Not an array or to many subscripts
Reply With Quote #4

Here's the full code

PHP Code:
#include < amxmodx >
#include < cstrike >
#include < colorchat >
#include < hamsandwich >
#include < engine >
#include < fakemeta >
#include < fun >

new g_iSimon;

new const 
g_szPrefix[ ] = "^04[Jailbreak]^01";

new 
gsCommanderMdlPrec[] = "models/player/scandic-gamers/commander.mdl";
new 
gsCommanderMdl[] = "Commander";
new 
gsCtMdl[] = "gign";

public 
plugin_init()
{
    
register_plugin"Commander & Decommander""1.0""MokeN" );
    
    
register_event"DeathMsg""Event_DeathMsg""a" );
         
register_event"RoundStart""evRoundStart""a""1=0""2=0" )
    
    
register_clcmd"say /commander""CmdSimon" );
    
register_clcmd"say /change""CmdChange" );
    
register_clcmd"say /decommander""CmdDeSimon" );
        
    
    
register_logevent"Event_RoundEvent"3"1=Round_Start""2=Round_End" );
    
    
set_task1.0"HudSimon", .flags="b" );
}

public 
evRoundStart()
{
    new 
players32 ], playernum;
    
get_playersplayersnum );
    for( new 
num ++ )
    {
        
player players];
        if( 
g_iSimon == player )
        
cs_set_user_modelplayergsCtMdl );
    }

    
g_iSimon 0;
    
    
server_cmd"mp_friendlyfire 0" );
}

public 
Event_RoundEvent()
{
    
g_iSimon 0;
}

public 
plugin_precache()
{
    
precache_modelgsCommanderMdlPrec );
}

public 
CmdChangeid )
{
    if( 
id != g_iSimon )
    {
        
ColorChatidNORMAL"%s Only the ^03Commander ^01can use this command."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    new 
hMenu menu_create"New Commander:""ChangeMenu_Handler" );
    
    new 
szName32 ], szData];
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"ae""CT" );
    
    for( new 
0iPlayeriNumi++ )
    {
        
iPlayer iPlayers];
        
        
get_user_nameiPlayerszNamecharsmaxszName ) );
        
num_to_striPlayerszDatacharsmaxszData ) );
        
        
menu_additemhMenuszNameszData );
    }
    
    
menu_displayidhMenu);
    
    return 
PLUGIN_HANDLED;
}

public 
ChangeMenu_HandleridhMenuiItem )
{
    if( 
iItem == MENU_EXIT )
    {
        
menu_destroyhMenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iAccesshCallbackszData], szName32 ];
    
menu_item_getinfohMenuiItemiAccessszDatacharsmaxszData ), szNamecharsmaxszName ), hCallback );
    
    new 
iPlayer str_to_numszData );
    
    if( !
is_user_aliveiPlayer ) )
    {
        
ColorChatidNORMAL"%s That player is no longer available to be ^03Commander^01."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iSimon iPlayer;
    
    
ColorChat0NORMAL"%s ^03%s ^01is the new ^03Commander^01."g_szPrefixszName );
    return 
PLUGIN_HANDLED;
}

public 
plugin_natives()
{
    
register_library("jb_simon");
    
    
register_native("jb_is_user_simon""_is_user_simon");    
}
    
public 
_is_user_simon(iPluginiParams)
{
    return 
g_iSimon[get_param(1)];
}

public 
CmdSimonid )
{
    if( 
cs_get_user_teamid ) != CS_TEAM_CT )
    {
        
ColorChatidNORMAL"%s ^01You must be a ^03Counter-Terrorist ^01to use this command."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
g_iSimon == id )
    {
        
ColorChatidNORMAL"%s ^01You are already the ^04Commander^01!"g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
is_user_aliveg_iSimon ) )
    {
        
ColorChatidNORMAL"%s ^01Somebody else is currently Commander."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    
g_iSimon id;
    
    new 
name[32];
    
get_user_nameidname31 );
    
    
ColorChat0NORMAL"%s ^03%s ^01 is now the Commander."g_szPrefixname );
        
cs_set_user_modelidgsCommanderMdl );
    return 
PLUGIN_CONTINUE;
    
}

public 
cmdDeSimonVictimshouldgib  )
{
    new 
victim read_data);
    
    if( !
is_user_connectedvictim ) )
        return 
PLUGIN_HANDLED;
    
    if( 
victim == g_iSimon )
    {
        
g_iSimon 0;
        
ColorChat0NORMAL"%s ^01Due /decommander vote, somebody else has to take the commander spot."g_szPrefix );
                   
cs_set_user_modelVictimgsCtMdl );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}
public 
HudSimon()
{
    
set_hudmessage02550, -1.00.0500.11.00.10.1);
    
    if( !
is_user_aliveg_iSimon ) )
    {
        
g_iSimon 0;
        
show_hudmessage0"There is currently nobody commanding." );
        return 
PLUGIN_HANDLED;
    }
    
    new 
name[32];
    
get_user_nameg_iSimonname31 );
    
    
show_hudmessage0"%s is the current Commander."name );
    
    return 
PLUGIN_HANDLED;
}

public 
client_disconnectid )
{
    if( 
g_iSimon == );
    {
        
g_iSimon 0;
        
        
ColorChat0NORMAL"%s ^01The current Commander has left the game."g_szPrefix );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}

public 
Event_DeathMsg(victim)
{
    new 
victim read_data);
    
    if( !
is_user_connectedvictim ) )
        return 
PLUGIN_HANDLED;
    
    if( 
victim == g_iSimon )
    {
        
ColorChat0NORMAL"%s ^01The current Commander has died."g_szPrefix );
        
g_iSimon 0;
                  
cs_set_user_modelvictimgsCtMdl );
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;

__________________
Private Works:
- Achievements, HNS & JB Menus, HNS & JB Shops

mY BlockMaker - mY Steam - mY Game Menu
MokeN is offline
Send a message via Skype™ to MokeN
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-28-2012 , 14:35   Re: Not an array or to many subscripts
Reply With Quote #5

PHP Code:
public _is_user_simon(iPluginiParams)
{
    return 
_:(g_iSimon == get_param(1));

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 14:37   Re: Not an array or to many subscripts
Reply With Quote #6

Why do you detag it? g_iSimon and get_param(1) are both integers and == operator returns 1 on success and 0 on failure or am I wrong?

Last edited by Backstabnoob; 06-28-2012 at 14:38.
Backstabnoob is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-28-2012 , 14:41   Re: Not an array or to many subscripts
Reply With Quote #7

Quote:
Originally Posted by Backstabnoob View Post
Why do you detag it? g_iSimon and get_param(1) are both integers and == operator returns 1 on success and 0 on failure or am I wrong?
Conditionals return booleans values.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 14:44   Re: Not an array or to many subscripts
Reply With Quote #8

Oh, didn't know that. Thanks for explanation.
Backstabnoob is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 06-28-2012 , 17:06   Re: Not an array or to many subscripts
Reply With Quote #9

Quote:
Originally Posted by Exolent[jNr] View Post
PHP Code:
public _is_user_simon(iPluginiParams)
{
    return 
_:(g_iSimon == get_param(1));

What means '_:' ?
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-28-2012 , 17:18   Re: Not an array or to many subscripts
Reply With Quote #10

It detags a value.
Backstabnoob 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 06:07.


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