AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [FIX REQ] Bazooka plugin error (https://forums.alliedmods.net/showthread.php?t=246314)

Dare.Devil 08-15-2014 10:30

[FIX REQ] Bazooka plugin error
 
hi all,

I get this error written in my logs.txt file when I play the server with bazooka plugin:
L 08/14/2014 - 18:21:04: [AMXX] Displaying debug trace (plugin "bazooka_fixed.amxx")
L 08/14/2014 - 18:21:04: [AMXX] Run time error 4: index out of bounds
L 08/14/2014 - 18:21:04: [AMXX] [0] bazooka_fixed.sma::player_bazooka (line 1283)

below is the PHP code ..line 1283 starts at the first line u see below..
hmm error: index out of bounds .. I can compile the plugin successfully as it is with no error..
but when I start playing it logs errors that can go over 20 MB in size
please help!!

PHP Code:

if (user_controll[id] > 0) { 
        new 
RocketEnt user_controll[id
        if (
is_valid_ent(RocketEnt)) { 
            new 
Float:Velocity[3
            
VelocityByAim(id500Velocity
            
entity_set_vector(RocketEntEV_VEC_velocityVelocity
            new 
Float:NewAngle[3
            
entity_get_vector(idEV_VEC_v_angleNewAngle
            
entity_set_vector(RocketEntEV_VEC_anglesNewAngle
        } 
        else { 
            
attach_view(idid
        } 
    } 
    return 
FMRES_IGNORED 



NikKOo31 08-15-2014 11:23

Re: [FIX REQ] Bazooka plugin error
 
Looks like bazooka_fixed it's not too fixed :P

PHP Code:

if (id || id >= sizeof user_control)
    return 
FMRES_IGNORED  

if (user_controll[id] > 0) {  
        new 
RocketEnt user_controll[id]  
        if (
is_valid_ent(RocketEnt)) {  
            new 
Float:Velocity[3]  
            
VelocityByAim(id500Velocity)  
            
entity_set_vector(RocketEntEV_VEC_velocityVelocity)  
            new 
Float:NewAngle[3]  
            
entity_get_vector(idEV_VEC_v_angleNewAngle)  
            
entity_set_vector(RocketEntEV_VEC_anglesNewAngle)  
        }  
        else {  
            
attach_view(idid)  
        }  
    }  
    return 
FMRES_IGNORED  



Dare.Devil 08-16-2014 09:38

Re: [FIX REQ] Bazooka plugin error
 
Quote:

Originally Posted by NikKOo31 (Post 2184363)
Looks like bazooka_fixed it's not too fixed :P

thanks that's very helpful :evil:

someone please advise how to fix

NikKOo31 08-16-2014 11:20

Re: [FIX REQ] Bazooka plugin error
 
Quote:

Originally Posted by Dare.Devil (Post 2184702)
thanks that's very helpful :evil:

someone please advise how to fix

Read the code I posted -.- I added

PHP Code:

if (id || id >= sizeof user_control
    return 
FMRES_IGNORED 

It's not the better way, but will stop the index out of bounds

aron9forever 08-16-2014 12:13

Re: [FIX REQ] Bazooka plugin error
 
could you please show me where user_controll is declared?
new user_controll or whatever

Flick3rR 08-16-2014 12:44

Re: [FIX REQ] Bazooka plugin error
 
It just has to have 33 cells and the id couldn't outbound it if id is a connected user (which is also important check).

Dare.Devil 08-16-2014 15:43

Re: [FIX REQ] Bazooka plugin error
 
1 Attachment(s)
Quote:

Originally Posted by NikKOo31 (Post 2184735)
Read the code I posted -.- I added

PHP Code:

if (id || id >= sizeof user_control
    return 
FMRES_IGNORED 

It's not the better way, but will stop the index out of bounds

yes at first it didn't work and gave error & fails to compile.. says unknown symbol user_control..

Then I thought for some reason the amx studio wants another l in the word "control" so now in it's spelled "controll"

it looks like below now and compiled successfully

PHP Code:

if (id || id >= sizeof user_controll
    return 
FMRES_IGNORED 

thx nikko hope it works.. I've attached the full .sma file for u guys to have a look at if u want

Dare.Devil 08-16-2014 16:29

Re: [FIX REQ] Bazooka plugin error
 
now here's another error that comes up

L 08/16/2014 - 22:31:01: [AMXX] Displaying debug trace (plugin "bazooka_fixed.amxx")
L 08/16/2014 - 22:31:01: [AMXX] Run time error 10: native error (native "cs_get_user_plant")
L 08/16/2014 - 22:31:01: [AMXX] [0] bazooka_fixed.sma::client_disconnect (line 395)

anyone help please?!
PHP Code:

public client_disconnect(id) {
/* Notes:
i now think that using switch_hands() here is too late to
put the player's cl_righthand cvar back to normal

I think i need to find an event that happens just before the player dc's
*/
    
ammo_hud(id0)
    if (
get_cvar_num("amx_bazooka_autohands") == 1) {
        
switch_hands(id,0)
    }
    
Munni[id] = 0
    user_controll
[id] = 0
    hasBazooka
[id] = false
    
if ((cs_get_user_plant(id) == 1) || cantswitch) {
        
cs_set_user_plant(id,0,0)
        
cantswitch  false
        
//if this person had the bomb out and dc'ed then the other players can now access the bomb
    
}



NikKOo31 08-16-2014 22:35

Re: [FIX REQ] Bazooka plugin error
 
Maybe because the player is already disconnected (?)

Change
PHP Code:

    if ((cs_get_user_plant(id) == 1) || cantswitch) { 
        
cs_set_user_plant(id,0,0
        
cantswitch  false 
    


To
PHP Code:

    if (cantswitch) { 
        
cantswitch  false 
    



Dare.Devil 08-17-2014 14:46

Re: [FIX REQ] Bazooka plugin error
 
Quote:

Originally Posted by NikKOo31 (Post 2184960)
Maybe because the player is already disconnected (?)

Change
PHP Code:

    if ((cs_get_user_plant(id) == 1) || cantswitch) { 
        
cs_set_user_plant(id,0,0
        
cantswitch  false 
    


To
PHP Code:

    if (cantswitch) { 
        
cantswitch  false 
    



I did like you said..it fixed it.. now I get another error in the logs..
seems like every time I fix 1 line I get another line giving error

can anyone help below
now I get this:
L 08/17/2014 - 20:27:52: [AMXX] Displaying debug trace (plugin "bazooka_fixed.amxx")
L 08/17/2014 - 20:27:52: [AMXX] Run time error 10: native error (native "attach_view")
L 08/17/2014 - 20:27:52: [AMXX] [0] bazooka_fixed.sma::pfn_touch (line 994)

PHP Code:

attach_view(entity_get_edict(ptrEV_ENT_owner), entity_get_edict(ptrEV_ENT_owner))
        
user_controll[entity_get_edict(ptrEV_ENT_owner)] = 0
        remove_entity
(ptr



All times are GMT -4. The time now is 13:16.

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