This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Solved error 4: index out of bounds (SG Teleport)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 03-02-2022 , 11:51   error 4: index out of bounds (SG Teleport)
Reply With Quote #1

Hi, well i try to make it work when you get sg teleport, but when you don't, make it work like normal smoke

I got it by doing this in the code:

PHP Code:
new bool:gHasBatman[SH_MAXSLOTS+1// its like [MAX_PLAYERS+1];

public plugin_init()
{
      
register_forward(FM_EmitSound"forward_emitsound")
      
register_forward(FM_PlaybackEvent"forward_playbackevent"false)
    
// we do not precaching, but retrieving the indexes
    
g_spriteid_steam1 engfunc(EngFunc_PrecacheModel"sprites/steam1.spr")
    
g_eventid_createsmoke engfunc(EngFunc_PrecacheEvent1"events/createsmoke.sc")
}

public 
forward_playbackevent(flagsinvokereventindex
{    
    if ( !
gHasBatman[invoker] ) return FMRES_IGNORED
    
// we do not need a large amount of smoke 
    
if( eventindex == g_eventid_createsmoke)
        return 
FMRES_SUPERCEDE

    
return FMRES_IGNORED

but I get error 4 every time the SG explodes

HTML Code:
L 03/02/2022 - 13:27:11: [AMXX] Displaying debug trace (plugin "sh_batman.amxx", version "1.2.0.14")
L 03/02/2022 - 13:27:11: [AMXX] Run time error 4: index out of bounds 
L 03/02/2022 - 13:27:11: [AMXX]    [0] sh_batman.sma::forward_playbackevent (line 3

Last edited by Arje; 03-02-2022 at 13:00.
Arje is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-02-2022 , 12:23   Re: error 4: index out of bounds (SG Teleport)
Reply With Quote #2

Most common error, easy to fix, you need to check if you have a valid invoker id.

Code:
    if ( !( invoker && invoker <= SH_MAXSLOTS) || !gHasBatman[invoker] ) return FMRES_IGNORED     //
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-02-2022 at 13:08.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Arje
Senior Member
Join Date: Apr 2020
Location: Córdoba, Argentina
Old 03-02-2022 , 13:00   Re: error 4: index out of bounds (SG Teleport)
Reply With Quote #3

Hi again! but i proof and it didn't work for me, but after searching more and more posts about this error, I found a solution that works, which is the following:

PHP Code:
public forward_playbackevent(flagsinvokereventindex
{    
    if ( !( 
<= invoker <= 32 ) || !is_user_alive(invoker) ) return FMRES_IGNORED 

    
if ( !gHasBatman[invoker] ) return FMRES_IGNORED 
    
// we do not need a large amount of smoke 
    
if( eventindex == g_eventid_createsmoke)
        return 
FMRES_SUPERCEDE

    
return FMRES_IGNORED     // FMRES_IGNORED 

pd: I made the thread because I saw like 15 posts with the same error and none had a solution but just after posting I found one with a solution for me... but thanks for the time!
Arje is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-02-2022 , 13:08   Re: error 4: index out of bounds (SG Teleport)
Reply With Quote #4

I made a simple mistake, fixed.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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:46.


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