Raised This Month: $32 Target: $400
 8% 

Solved index out of bounds - function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 01-22-2021 , 06:14   index out of bounds - function
Reply With Quote #1

hello again. sorry for spaming with topics but i got a lot of free time. soo, i get this error

Code:
L 01/22/2021 - 13:08:47: [AMXX] Displaying debug trace (plugin "playermenu.amxx", version "2.0")
L 01/22/2021 - 13:08:47: [AMXX] Run time error 4: index out of bounds
L 01/22/2021 - 13:08:47: [AMXX] [0] playermenu.sma::camreset (line 677)
and this is the code
PHP Code:
public camroundstart(id){
    
remove_task(id CamTask)
    
set_task(get_pcvar_float(CamResetTime), "camreset",id CamTask)
    
camset[id] = false
}

public 
camreset(id){
    
camset[id] = true
    camera
[id] = false
    
if (is_user_alive(id))    set_view(idCAMERA_NONE)

line 677
PHP Code:
 set_task(get_pcvar_float(CamResetTime), "camreset",id CamTask
"camreset" is a function but i get "index out of bounds".

Last edited by lexzor; 01-22-2021 at 09:25.
lexzor is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 01-22-2021 , 06:46   Re: index out of bounds - function
Reply With Quote #2

Show us how camset[id] and camera[id] are being initialized or better yet, post the full code.
__________________








CrazY. is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-22-2021 , 07:36   Re: index out of bounds - function
Reply With Quote #3

You're accessing "id + CamTask" there, not "id".
Do "id -= CamTask" in the first line of "camreset".
__________________

Last edited by OciXCrom; 01-22-2021 at 07:36.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
lexzor
Veteran Member
Join Date: Nov 2020
Old 01-22-2021 , 09:25   Re: index out of bounds - function
Reply With Quote #4

i did what ocixcrom said and it's working now, thanks i just learned how this set_tasks ids works.
lexzor is offline
Reply


Thread Tools
Display Modes

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


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