Raised This Month: $ Target: $400
 0% 

error 028: invalid subscript (not an array or too many subscripts): "bhop"


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 08-21-2013 , 14:13   error 028: invalid subscript (not an array or too many subscripts): "bhop"
Reply With Quote #1

Hello all.


I have a simple plugin called 'auto bhop', it enables bhop for everyone with chat command (by default it's disabled [false]), here's a part of it:

PHP Code:
static bool:bhop=false

public plugin_init()
{

    
RegisterHam(Ham_Player_Jump"player""Player_Jump")
    
register_forward(FM_UpdateClientData"UpdateClientData")
    
register_forward(FM_CmdStart"CmdStart")
    
RegisterHam(Ham_Spawn"player""Check_Alive"1)
    
RegisterHam(Ham_Killed"player""Check_Alive"1)
    
    
g_pcvarGravity get_cvar_pointer("sv_gravity")
}

public 
Check_Alive(id)
{
    
g_bAlive[id] = bool:is_user_alive(id)
}

public 
CmdStart(iduc_handleseed)
{
    if(    
g_bAlive[id]
    &&    
get_uc(uc_handleUC_Buttons) & IN_USE
    
&&    pev(idpev_flags) & FL_ONGROUND    )
    {
        static 
Float:fVelocity[3]
        
pev(idpev_velocityfVelocity)
        
fVelocity[0] *= 0.3
        fVelocity
[1] *= 0.3
        fVelocity
[2] *= 0.3
        set_pev
(idpev_velocityfVelocity)
    }
}

public 
Player_Jump(id)
{
    if( !
g_bAlive[id] || !bhop[id] ) // "bhop[id] == false" also don't work
    
{
        return
    }

    if( 
g_iCdWaterJumpTime[id] )
    {
        
//client_print(id, print_center, "Water Jump !!!")
        
return
    }

    if( 
pev(idpev_waterlevel) >= )
    {
        return
    }

    static 
iFlags iFlags pev(idpev_flags)
    if( !(
iFlags FL_ONGROUND) )
    {
        return
    }

    static 
iOldButtons iOldButtons pev(idpev_oldbuttons)

    
// prevent the game from making the player jump
    // as supercede this forward just fails
    
set_pev(idpev_oldbuttonsiOldButtons IN_JUMP)

    static 
Float:fVelocity[3]
    
pev(idpev_velocityfVelocity)

    
    static 
Float:fMaxScaledSpeed
    pev
(idpev_maxspeedfMaxScaledSpeed)
    if(
fMaxScaledSpeed 0.0)
    {
        
fMaxScaledSpeed *= BUNNYJUMP_MAX_SPEED_FACTOR
        
static Float:fSpeed
        fSpeed 
floatsqroot(fVelocity[0]*fVelocity[0] + fVelocity[1]*fVelocity[1] + fVelocity[2]*fVelocity[2])
        if(
fSpeed fMaxScaledSpeed)
        {
            static 
Float:fFraction
            fFraction 
= ( fMaxScaledSpeed fSpeed ) * 0.65
            fVelocity
[0] *= fFraction
            fVelocity
[1] *= fFraction
            fVelocity
[2] *= fFraction
        
}
    }
    
    

    static 
Float:fFrameTimeFloat:fPlayerGravity
    global_get
(glb_frametimefFrameTime)
    
pev(idpev_gravityfPlayerGravity)

    new 
iLJ
    
if(    (pev(idpev_bInDuck) || iFlags FL_DUCKING)
    &&    
get_pdata_int(idOFFSET_CAN_LONGJUMP)
    &&    
pev(idpev_button) & IN_DUCK
    
&&    pev(idpev_flDuckTime)    )
    {
        static 
Float:fPunchAngle[3], Float:fForward[3]
        
pev(idpev_punchanglefPunchAngle)
        
fPunchAngle[0] = -5.0
        set_pev
(idpev_punchanglefPunchAngle)
        
global_get(glb_v_forwardfForward)

        
fVelocity[0] = fForward[0] * 560
        fVelocity
[1] = fForward[1] * 560
        fVelocity
[2] = 299.33259094191531084669989858532
        iLJ 
1
    
}
    else
    {
        
fVelocity[2] = 268.32815729997476356910084024775
    
}

    
fVelocity[2] -= fPlayerGravity fFrameTime 0.5 get_pcvar_num(g_pcvarGravity)

    
set_pev(idpev_velocityfVelocity)

    
set_pev(idpev_gaitsequencePLAYER_JUMP+iLJ)
    
set_pev(idpev_frame0.0)
}

public 
UpdateClientData(idsendweaponscd_handle)
{
    
g_iCdWaterJumpTime[id] = get_cd(cd_handleCD_WaterJumpTime)
}

public 
client_putinserver(id)
{
    
bhop[id] = false;
}

public 
client_disconnect(id)
{
    
bhop[id] = 0;

But i have strange issue. I don't really understand why.

PHP Code:
error 028invalid subscript (not an array or too many subscripts): "bhop" 
In this line:

PHP Code:
if( !g_bAlive[id] || !bhop[id] ) 
I tried

PHP Code:
if( !g_bAlive[id] || bhop[id] == false 
PHP Code:
if( !g_bAlive[id] || bhop[id] == 
But nothing changed....the error is present. I don't really understand, why i can't determinate bool state with simple if condition and 'true' 'false', that's the prob?
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
 



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 15:53.


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