Raised This Month: $ Target: $400
 0% 

[REQ]weapon-x Error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jiunnwoei2629
BANNED
Join Date: Apr 2008
Old 01-17-2009 , 07:37   [REQ]weapon-x Error
Reply With Quote #1

[AMXX] Displaying debug trace (plugin "weapon-x.amxx")
[AMXX] Run time error 4: index out of bounds
[AMXX] [0] weapon-x.sma::doDamage (line 56
There was an error
PHP Code:
register_event("Damage""doDamage""b""2!0")
 
if (!
xmp5_carrier[plrAttacker] && !xm3_carrier[plrAttacker] && !xarmor_carrier[plrAttacker] && !xkevlar_carrier[plrAttacker] && !xknife_carrier[plrAttacker] && !xrevolver_carrier[plrAttacker]) 
He note that there is an error
Please help amendments
Attached Files
File Type: sma Get Plugin or Get Source (weapon-x.sma - 791 views - 33.8 KB)
jiunnwoei2629 is offline
jiunnwoei2629
BANNED
Join Date: Apr 2008
Old 01-17-2009 , 08:02   Re: [REQ]weapon-x Error
Reply With Quote #2

Other errors
PHP Code:
Invalid player id 0
[AMXXDisplaying debug trace (plugin "weapon-x.amxx")
[
AMXXRun time error 10native error (native "get_user_attacker")
[
AMXX]    [0weapon-x.sma::doDamage (line 567
jiunnwoei2629 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 01-17-2009 , 11:23   Re: [REQ]weapon-x Error
Reply With Quote #3

Show full code.
__________________
hleV is offline
jiunnwoei2629
BANNED
Join Date: Apr 2008
Old 01-17-2009 , 11:29   Re: [REQ]weapon-x Error
Reply With Quote #4

PHP Code:
public doDamage(id){
    if (
get_cvar_num("sv_xweapons")==0){
        return 
PLUGIN_CONTINUE
    
}
    new 
plrDmg read_data(2)
    new 
plrWeap
    
new plrPartHit
    
new plrAttacker get_user_attacker(idplrWeapplrPartHit)
    if (!
xmp5_carrier[plrAttacker] && !xm3_carrier[plrAttacker] && !xarmor_carrier[plrAttacker] && !xkevlar_carrier[plrAttacker] && !xknife_carrier[plrAttacker] && !xrevolver_carrier[plrAttacker]){
        return 
PLUGIN_CONTINUE
    
}
    if (!
is_user_alive(id)){
        return 
PLUGIN_CONTINUE
    
}
    new 
plrHealth get_user_health(id)
    new 
plrNewDmg
    
new headshot
    
if (plrPartHit==1){
       
headshot=1
    
}else{
       
headshot=0
    
}
    
//
    // plrDmg is set to how much damage was done to the victim
    // plrHealth is set to how much health the victim has
    // plrAttacker is set to the id of the person doing the shooting
    //
    // Could have put the above on one line, didn't for learning purposes (nubs may read this!) lol
    // Example: new plrWeap, plrPartHit, plrAttacker = get_user_attacker( .. etc etc
    //
    
if (plrWeap == CSW_MP5NAVY && xmp5_carrier[plrAttacker]){
        
// If the victim is still alive.. (should be)
        
plrDmg floatround(float(plrDmg) * weapdamg[Uweapid[plrAttacker]])
        
plrNewDmg = (plrHealth plrDmg)
        
//
        // Make the new damage their current health - plrDmg..
        // This is actually damage 2x, becuase when they did the damage
        // lets say it was 10, now this is subtracting 10 from current heatlh
        // doing 20, so thats 2 times =D
        //
        
if(plrNewDmg 1){
            
// If the new damage will kill the player..
            
message_begin(MSG_ALLget_user_msgid("DeathMsg"), {0,0,0}, 0)
            
// Start a death message, so it doesnt just say "Player Died",
            // the killer will get the credit
            
            
write_byte(plrAttacker)
            
// Write KILLER ID
            
            
write_byte(id)
            
// Write VICTIM ID
            
            
write_byte(headshot)
            
// Write HEAD SHOT or not
            
            
write_string("mp5navy")
            
// Write the weapon VICTIM ID was killed with..
            
            
message_end()
            
// End the message..
            
fm_set_user_frags(idget_user_frags(id)+1)
            
fm_set_user_frags(plrAttackerget_user_frags(plrAttacker)+1)
        }
        
fm_set_user_health(idplrNewDmg)
        
// Then set the health, even if it will kill the player
    
}
    if (
plrWeap == CSW_M3 && xm3_carrier[plrAttacker]){
        
plrDmg floatround(float(plrDmg) * weapdamg[Uweapid[plrAttacker]])
        
plrNewDmg = (plrHealth plrDmg)
        if(
plrNewDmg 1){
            
message_begin(MSG_ALLget_user_msgid("DeathMsg"), {0,0,0}, 0)
            
write_byte(plrAttacker)
            
write_byte(id)
            
write_byte(headshot)
            
write_string("m3")
            
message_end()
            
fm_set_user_frags(idget_user_frags(id)+1)
            
fm_set_user_frags(plrAttackerget_user_frags(plrAttacker)+1)
        }
        
fm_set_user_health(idplrNewDmg)
        
// Then set the health, even if it will kill the player
    
}
    if (
plrWeap == CSW_KNIFE && xknife_carrier[plrAttacker]){
        
plrDmg floatround(float(plrDmg) * weapdamg[Uweapid[plrAttacker]])
        
plrNewDmg = (plrHealth plrDmg)
        if(
plrNewDmg 1){
            
message_begin(MSG_ALLget_user_msgid("DeathMsg"), {0,0,0}, 0)
            
write_byte(plrAttacker)
            
write_byte(id)
            
write_byte(headshot)
            
write_string("knife")
            
message_end()
            
fm_set_user_frags(idget_user_frags(id)+1)
            
fm_set_user_frags(plrAttackerget_user_frags(plrAttacker)+1)
        }
        
fm_set_user_health(idplrNewDmg)
        
// Then set the health, even if it will kill the player
    
}
    if (
plrWeap == CSW_DEAGLE && xrevolver_carrier[plrAttacker]){
 if(
random_num(1,99) <= LOKO_BULLET){
  new 
origin[3]
  
get_user_origin(plrAttacker,origin)
  
// random explosions
  
message_beginMSG_PVSSVC_TEMPENTITYorigin )
  
write_byteTE_EXPLOSION// This just makes a dynamic light now
  
write_coordorigin[0] + random_num( -100100 ))
  
write_coordorigin[1] + random_num( -100100 ))
  
write_coordorigin[2] + random_num( -5050 ))
  
write_shortg_sModelFireball )
  
write_byterandom_num(0,20) + 20  // scale * 10
  
write_byte12  // framerate
  
write_byteTE_EXPLFLAG_NONE )
  
message_end()
  
// lots of smoke
  
message_beginMSG_PVSSVC_TEMPENTITYorigin )
  
write_byteTE_SMOKE )
  
write_coordorigin[0] + random_num( -100100 ))
  
write_coordorigin[1] + random_num( -100100 ))
  
write_coordorigin[2] + random_num( -5050 ))
  
write_shortg_sModelSmoke )
  
write_byte60 // scale * 10
  
write_byte10  // framerate
  
message_end()
  new 
randomdamage get_user_health(plrAttacker) - random_num60120 )
  
fm_set_user_health(plrAttackerrandomdamage)
  
client_print(plrAttacker,print_chat,"[KPS-X] Hey, that crazy bullet just tore your head off!")
 }
        
plrDmg floatround(float(plrDmg) * weapdamg[Uweapid[plrAttacker]])
        
plrNewDmg = (plrHealth plrDmg)
        if(
plrNewDmg 1){
            
message_begin(MSG_ALLget_user_msgid("DeathMsg"), {0,0,0}, 0)
            
write_byte(plrAttacker)
            
write_byte(id)
            
write_byte(headshot)
            
write_string("deagle")
            
message_end()
            
fm_set_user_frags(idget_user_frags(id)+1)
            
fm_set_user_frags(plrAttackerget_user_frags(plrAttacker)+1)
        }
        
fm_set_user_health(idplrNewDmg)
        
// Then set the health, even if it will kill the player
    
}
    if (
xarmor_carrier[plrAttacker] && get_user_armor(id) >= 1){
        new 
armordmg
        armordmg 
floatround(float(plrDmg) * MOD_ARMOR)
        
fm_set_user_armor(id,get_user_armor(id)-armordmg)
    }
    if (
xkevlar_carrier[id] && is_user_alive(id)){
        new 
kevldmg
        kevldmg 
floatround((float(plrDmg) * MOD_KEVLAR)+float(plrHealth))
        
fm_set_user_health(idkevldmg)
    }
    return 
PLUGIN_CONTINUE

jiunnwoei2629 is offline
jiunnwoei2629
BANNED
Join Date: Apr 2008
Old 01-18-2009 , 09:21   Re: [REQ]weapon-x Error
Reply With Quote #5

PHP Code:
if (!xmp5_carrier[plrAttacker] && !xm3_carrier[plrAttacker] && !xarmor_carrier[plrAttacker] && !xkevlar_carrier[plrAttacker] && !xknife_carrier[plrAttacker] && !xrevolver_carrier[plrAttacker]) 
I put the modified
PHP Code:
if (!xmp5_carrier[id] && !xm3_carrier[id] && !xarmor_carrier[id] && !xkevlar_carrier[id] && !xknife_carrier[id] && !xrevolver_carrier[id]) 
Can be solved
Other [plrAttacker] have changed [id]
PHP Code:
if (!xmp5_carrier[id] && !xm3_carrier[id] && !xarmor_carrier[id] && !xkevlar_carrier[id] && !xknife_carrier[id] && !xrevolver_carrier[id]) 
Some inside only to the needs of
Others do not change

Inside there is a problem
Why can not use custommenuitems.cfg ?

Amx_menu use after the menu appears, but the option to press the gunshop is not something
jiunnwoei2629 is offline
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 01:45.


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