AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   index out of bounds (https://forums.alliedmods.net/showthread.php?t=51274)

dEMolite 02-14-2007 17:09

index out of bounds
 
Hi Guys i become this littel fucking error in ct_show_timer (line 1336)

Code:
if( climbstatus[id] == CT_STATUS_NONE ) {         new hud_text[256]                 set_hudmessage( 54, 113, 156, 0.3, 0.0, 0, 0.0, 5.0, 0.0, 0.5, 1 )         if(gChecks[id] > 1)         {             format( hud_text, 255, "[ Time: 00:00 | Status: None | Checkpoint: %s ]",gChecks[id] )         }else{             format( hud_text, 255, "[ Time: 00:00 | Status: None | Checkpoint: 0 ]" )         }         show_hudmessage( id, hud_text )                 return PLUGIN_HANDLED     }

I hope anyone can help me.

Howdy! 02-14-2007 17:19

Re: index out of bounds
 
(ban this user)

dEMolite 02-14-2007 17:20

Re: index out of bounds
 
nothing only in game the Runtime Error 4: index out of bounds

lunarwolfx 02-14-2007 18:34

Re: index out of bounds
 
which one is like 1336?

dEMolite 02-15-2007 14:34

Re: index out of bounds
 
This ones:
if( climbstatus[id] == CT_STATUS_NONE ) {

teame06 02-15-2007 14:46

Re: index out of bounds
 
Post the whole function not just that section of the code and what is calling that function.

Greenberet 02-15-2007 16:20

Re: index out of bounds
 
Code:
format( hud_text, 255, "[ Time: 00:00 | Status: None | Checkpoint: %s ]",gChecks[id] )
should be
Code:
format( hud_text, 255, "[ Time: 00:00 | Status: None | Checkpoint: %i ]",gChecks[id] )

dEMolite 02-15-2007 17:43

Re: index out of bounds
 
Okay here for teamme06
This is the funktion
Code:
public ct_show_timer(id) {     if( !climbtimer_on )         return PLUGIN_CONTINUE         if( climbstatus[id] == CT_STATUS_NONE ) {         new hud_text[300]             set_hudmessage( 54, 113, 156, 0.3, 0.0, 0, 0.0, 0.5, 0.0, 0.0, 4 )         if(gChecks[id] > 1)         {             format( hud_text, 299, "[ Time: 00:00 | Status: None | Checkpoint: %s ]",gChecks[id] )             //show_hudmessage( i, "[ Time: 00:00 | Status: None | Checkpoint: %s ]",gChecks[i] )         }else{             format( hud_text, 299, "[ Time: 00:00 | Status: None | Checkpoint: 0 ]" )             //show_hudmessage( i, "[ Time: 00:00 | Status: None | Checkpoint: 0 ]" )         }         show_hudmessage( id, hud_text )             return PLUGIN_HANDLED     }     if( climbstatus[id] == CT_STATUS_CLIMBING ) {         new hud_text[256]             set_hudmessage( 54, 113, 156, 0.3, 0.0, 0, 0.0, 5.0, 0.0, 0.5, 4 )         if(gChecks[id] > 1)         {             //show_hudmessage( i, "[ Time: %d:%02d | Status: Climbing | Checkpoint: %s ]", (climbtime/60) , (climbtime%60),gChecks[i] )             format( hud_text, 255, "[ Time: %d:%02d | Status: Climbing | Checkpoint: %s ]", (climbtime/60) , (climbtime%60),gChecks[id] )         }else{             //show_hudmessage( i, "[ Time: %d:%02d | Status: Climbing | Checkpoint: 0 ]", (climbtime/60) , (climbtime%60),gChecks[i] )             format( hud_text, 255, "[ Time: %d:%02d | Status: Climbing | Checkpoint: 0 ]", (climbtime/60) , (climbtime%60),gChecks[id] )         }         show_hudmessage( id, hud_text )                     return PLUGIN_HANDLED       }     if( climbstatus[id] == CT_STATUS_FINISHED ) {         new hud_text[256]             set_hudmessage( 54, 113, 156, 0.3, 0.0, 0, 0.0, 5.0, 0.0, 0.5, 4 )         if(gChecks[id] > 1)         {             format( hud_text, 255, "[ Time: %d:%02d | Status: Finished | Checkpoint: %s ]", (climbertime[id]/60) , (climbertime[id]%60),gChecks[id] )         }else{             format( hud_text, 255, "[ Time: %d:%02d | Status: Finished | Checkpoint: 0 ]", (climbertime[id]/60) , (climbertime[id]%60),gChecks[id] )         }         show_hudmessage( id, hud_text )                 return PLUGIN_HANDLED       }     return PLUGIN_HANDLED }

And this is how i call it in plugininit
Code:
set_task(0.5, "ct_show_timer", id+334490, "", 0, "b", 0);

teame06 02-15-2007 18:28

Re: index out of bounds
 
Code:
public ct_show_timer(id) {     if( !climbtimer_on )         return PLUGIN_CONTINUE     // if your going to pass the id with task id.     You need to subtract it out later. So your way out of bounds.     id -= 334490;

dEMolite 02-16-2007 13:37

Re: index out of bounds
 
with id -= 334490 works.
Thanks team06 you helped me alot ;)


All times are GMT -4. The time now is 00:43.

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