Raised This Month: $ Target: $400
 0% 

Plugin crash "get_user_weapon"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-30-2013 , 09:08   Plugin crash "get_user_weapon"
Reply With Quote #1

I am getting this error in console.
It might make my server lag.
I don't know if our server got ddosed or it was this plugin causing it.


Code:
L 07/30/2013 - 14:54:45: Invalid player id 0
L 07/30/2013 - 14:54:45: [AMXX] Run time error 10 (plugin "Achievements.amxx") (native "get_user_weapon") - debug not enabled!
L 07/30/2013 - 14:54:45: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).


PHP Code:
#include <amxmodx> 
#include <colorchat> 
#include <fakemeta> 
#include <engine> 
#include <xs> 
#include <nvault> 

#define VERSION "1.0.0" 

#define MaxPlayers 33 

new TotalAchievements[33
new 
iTotalAchievements 13 
new gVault 
new gVaultClose 

new const szAchievementSound[] = "swekung/AchievementReach.wav" 

enum _:iAchCount 
    
DIES
    
SPRAYS
    
KILLS
    
CONNECT
    
HEADSHOT
    
KNIFE
    
DISTANCE
    
SURVIVE
    
GRENADE
    
USP
    
GLOCK
    
SNEAKY
    
DEAGLE 


new const 
iAchPoints[iAchCount] = { 
    
500
    
1000
    
1000
    
500
    
500
    
100
    
3
    
100
    
50
    
250
    
250
    
100
    
250 


new 
iAchLevel[MaxPlayers][iAchCount


new const 
Float:vecNullOrigin[3

new 
Float:flDistance[MaxPlayers
new 
Float:vecOldOrigin[MaxPlayers][3
new 
Float:g_iFeet 35.0 

public plugin_init() { 
    
register_plugin("JailBreak Achievements"VERSION"Unknown"
     
    
// Commands 
    
register_clcmd("say /achs""Cmd_ShowAchievements"
    
register_clcmd("say /achievements""Cmd_ShowAchievements"
     
    
// Events 
    
register_event("DeathMsg""eDeath""a"
    
register_event("23""player_spray""a""1=112"
    
register_event("SendAudio""TerrorWins""a""2=%!MRAD_terwin"
     
    
// Fakemeta 
    
register_forward(FM_CmdStart"CmdStart"
     
    
// nVault 
    
gVault nvault_open("AchievementSystem"


public 
plugin_natives() { 
    
register_library("AchievementsNatives"
     
    
register_native("get_user_achievements""_get_achievements"
    
register_native("set_user_achievements""_set_achievements"



public 
_get_achievements(id) { 
    return 
TotalAchievements[get_param(1)] 


public 
_set_achievements(idAchievements) { 
    new 
iPlayer get_param(1
    
TotalAchievements[iPlayer] = max(0get_param(2)) 
     
    if(
TotalAchievements[iPlayer] > 13) { 
        return 
PLUGIN_HANDLED 
    

     
    return 
TotalAchievements[iPlayer



public 
plugin_precache() { 
    
precache_sound(szAchievementSound


public 
plugin_end() { 
    
nvault_close(gVaultClose


public 
TerrorWins() {      
    new 
players[32], count 
    get_players
(playerscount"ae""TERRORIST"
    if(
count == 1) { 
         
        new 
id players[0
        
iAchLevel[id][SURVIVE]++ 
         
        if(
iAchLevel[id][SURVIVE] == 100) { 
            
TotalAchievements[id]++ 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Congratulations! You have unclocked the achievement:^3 Survivor!"
        } 
    } 


public 
client_putinserver(id) { 
    
iAchLevel[id][CONNECT]++ 
    switch(
iAchLevel[id][CONNECT]) { 
        case 
500: { 
            
set_task(2.0"ReachAddict"id// Avoid playing the sound and printing the message to early. 
        

    } 
    
LoadData(id


public 
ReachAddict(id) { 
    
TotalAchievements[id]++ 
    
ColorChat(idGREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Addict!"
    
emit_sound(idCHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM


public 
eDeath() { 
    new 
iClipiAmmoiWeapon get_user_weapon(read_data(1), iClipiAmmo
     
    static 
weapon[8
    
read_data(4weaponcharsmax(weapon)) 
  
     
    if(
is_user_alive(read_data(1))) { 
        
iAchLevel[read_data(1)][KILLS]++ 
    } 
     
    if(
read_data(3)) { 
        
iAchLevel[read_data(1)][HEADSHOT]++ 
    } 
     
    if(
iWeapon == CSW_KNIFE) { 
        
iAchLevel[read_data(1)][KNIFE]++ 
    } 
     
    if(
equal(weapon,"grenade")) { 
        
iAchLevel[read_data(1)][GRENADE]++ 
    } 
     
    if(
iWeapon == CSW_USP) { 
        
iAchLevel[read_data(1)][USP]++ 
    } 
     
    if(
iWeapon == CSW_GLOCK18) { 
        
iAchLevel[read_data(1)][GLOCK]++ 
    } 
     
    if(
iWeapon == CSW_DEAGLE) { 
        
iAchLevel[read_data(1)][DEAGLE]++ 
    } 
     
    if(
get_user_weapon(read_data(2)) == CSW_AWP && iWeapon == CSW_KNIFE) { 
        
iAchLevel[read_data(1)][SNEAKY]++ 
    } 
     
    
iAchLevel[read_data(2)][DIES]++ 
     
    switch(
iAchLevel[read_data(2)][DIES]) { 
        case 
500: { 
            
TotalAchievements[read_data(2)]++ 
            
ColorChat(read_data(2), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Anti-GodMode!"
            
emit_sound(read_data(2), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 
     
    switch(
iAchLevel[read_data(1)][KILLS]) { 
        case 
1000: { 
            
TotalAchievements[read_data(1)]++ 
            
ColorChat(read_data(1), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Prison Breaker!"
            
emit_sound(read_data(1), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 
     
    switch(
iAchLevel[read_data(1)][HEADSHOT]) { 
        case 
500: { 
            
TotalAchievements[read_data(1)]++ 
            
ColorChat(read_data(1), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 HeadzHunterz!"
            
emit_sound(read_data(1), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 
     
    switch(
iAchLevel[read_data(1)][KNIFE]) { 
        case 
100: { 
            
TotalAchievements[read_data(1)]++ 
            
ColorChat(read_data(1), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 The Butcher!"
            
emit_sound(read_data(1), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 
     
    switch(
iAchLevel[read_data(1)][GRENADE]) { 
        case 
50: { 
            
TotalAchievements[read_data(1)]++ 
            
ColorChat(read_data(1), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Grenadier!"
            
emit_sound(read_data(1), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 
     
    switch(
iAchLevel[read_data(1)][USP]) { 
        case 
250: { 
            
TotalAchievements[read_data(1)]++ 
            
ColorChat(read_data(1), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Officer!"
            
emit_sound(read_data(1), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 
     
    switch(
iAchLevel[read_data(1)][GLOCK]) { 
        case 
250: { 
            
TotalAchievements[read_data(1)]++ 
            
ColorChat(read_data(1), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Glocker!"
            
emit_sound(read_data(1), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 
     
    switch(
iAchLevel[read_data(1)][SNEAKY]) { 
        case 
100: { 
            
TotalAchievements[read_data(1)]++ 
            
ColorChat(read_data(1), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Sneaky..."
            
emit_sound(read_data(1), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 
    switch(
iAchLevel[read_data(1)][DEAGLE]) { 
        case 
250: { 
            
TotalAchievements[read_data(1)]++ 
            
ColorChat(read_data(1), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Too easy"
            
emit_sound(read_data(1), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 


public 
player_spray() { 
    
iAchLevel[read_data(2)][SPRAYS]++ 
     
    switch(
iAchLevel[read_data(2)][SPRAYS]) { 
        case 
1000: { 
            
TotalAchievements[read_data(2)]++ 
            
ColorChat(read_data(2), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Graffity Gangster!"
            
emit_sound(read_data(2), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM
        } 
    } 


public 
Cmd_ShowAchievements(id) { 
    new 
szTemp[500 char
    
formatex(szTempcharsmax(szTemp), "JailBreak Achievements Menu^nTotal Achievements: \r%i/%i"TotalAchievements[id], iTotalAchievements
     
    new 
menu menu_create(szTemp"Ach_Handler"
     
    
formatex(szTempcharsmax(szTemp), "Anti-GodMode! \r%i/%i"iAchLevel[id][DIES], iAchPoints[DIES]) 
    
menu_additem(menuszTemp"1"
     
    
formatex(szTempcharsmax(szTemp), "Graffity Gangster! \r%i/%i"iAchLevel[id][SPRAYS], iAchPoints[SPRAYS]) 
    
menu_additem(menuszTemp"2"
     
    
formatex(szTempcharsmax(szTemp), "Prison Breaker! \r%i/%i"iAchLevel[id][KILLS], iAchPoints[KILLS]) 
    
menu_additem(menuszTemp"3"
     
    
formatex(szTempcharsmax(szTemp), "Addict! \r%i/%i"iAchLevel[id][CONNECT], iAchPoints[CONNECT]) 
    
menu_additem(menuszTemp"4"
     
    
formatex(szTempcharsmax(szTemp), "HeadzHunterz! \r%i/%i"iAchLevel[id][HEADSHOT], iAchPoints[HEADSHOT]) 
    
menu_additem(menuszTemp"5"
     
    
formatex(szTempcharsmax(szTemp), "The Butcher! \r%i/%i"iAchLevel[id][KNIFE], iAchPoints[KNIFE]) 
    
menu_additem(menuszTemp"6"
     
    
formatex(szTempcharsmax(szTemp), "Sprinter! \r%i/%i"iAchLevel[id][DISTANCE], iAchPoints[DISTANCE]) 
    
menu_additem(menuszTemp"7"
     
    
formatex(szTempcharsmax(szTemp), "Survivor! \r%i/%i"iAchLevel[id][SURVIVE], iAchPoints[SURVIVE]) 
    
menu_additem(menuszTemp"8"
     
    
formatex(szTempcharsmax(szTemp), "Grenadier! \r%i/%i"iAchLevel[id][GRENADE], iAchPoints[GRENADE]) 
    
menu_additem(menuszTemp"9"
     
    
formatex(szTempcharsmax(szTemp), "Officer! \r%i/%i"iAchLevel[id][USP], iAchPoints[USP]) 
    
menu_additem(menuszTemp"10"
     
    
formatex(szTempcharsmax(szTemp), "Glocker! \r%i/%i"iAchLevel[id][GLOCK], iAchPoints[GLOCK]) 
    
menu_additem(menuszTemp"11"
     
    
formatex(szTempcharsmax(szTemp), "Sneaky... \r%i/%i"iAchLevel[id][SNEAKY], iAchPoints[SNEAKY]) 
    
menu_additem(menuszTemp"12"
     
    
formatex(szTempcharsmax(szTemp), "Too easy \r%i/%i"iAchLevel[id][DEAGLE], iAchPoints[DEAGLE]) 
    
menu_additem(menuszTemp"13"
     
    
menu_display(idmenu


public 
Ach_Handler(idmenuitem) { 
    if(
item == MENU_EXIT) { 
        
menu_destroy(menu
        return 
PLUGIN_HANDLED 
    

     
    switch(
item) { 
        case 
0: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Reach^3 %i^1 deaths to unlock this^4 Achievement!"iAchPoints[DIES]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][DIES], iAchPoints[DIES]) 
        } 
        case 
1: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Reach^3 %i^1 sprays to unlock this^4 Achievement!"iAchPoints[SPRAYS]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][SPRAYS], iAchPoints[SPRAYS]) 
        } 
        case 
2: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Reach^3 %i^1 kills to unlock this^4 Achievement!"iAchPoints[KILLS]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][KILLS], iAchPoints[KILLS]) 
        } 
        case 
3: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Reach^3 %i^1 connects to unlock this^4 Achievement!"iAchPoints[CONNECT]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][CONNECT], iAchPoints[CONNECT]) 
        } 
        case 
4: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Reach^3 %i^1 headshots to unlock this^4 Achievement!"iAchPoints[HEADSHOT]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][HEADSHOT], iAchPoints[HEADSHOT]) 
        } 
        case 
5: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Reach^3 %i^1 knife kills to unlock this^4 Achievement!"iAchPoints[KNIFE]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][KNIFE], iAchPoints[KNIFE]) 
        } 
        case 
6: { 
            new 
Float:footsteps flDistance[id] / g_iFeet 
             
            ColorChat
(idGREEN"[SWE-KUNG]^1 Reach^3 52800^1 footsteps to unlock this achievement!"
            
ColorChat(idGREEN"[SWE-KUNG]^3 %f/52800."footsteps
        } 
        case 
7: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Survive^3 %i^1 rounds to unlock this achievement!"iAchPoints[SURVIVE]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][SURVIVE], iAchPoints[SURVIVE]) 
        } 
        case 
8: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Kill^3 %i^1 players with a he grenade to unlock this achievement!"iAchPoints[GRENADE]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][GRENADE], iAchPoints[GRENADE]) 
        } 
        case 
9: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Kill^3 %i^1 players with a USP to unlock this achievement!"iAchPoints[USP]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][USP], iAchPoints[USP]) 
        } 
        case 
10: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Kill^3 %i^1 players with a Glock18 to unlock this achievement!"iAchPoints[GLOCK]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][GLOCK], iAchPoints[GLOCK]) 
        } 
        case 
11: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Kill^3 %i^1 players with a knife while they carry an AWP to unlock this achievement!"iAchPoints[SNEAKY]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][SNEAKY], iAchPoints[SNEAKY]) 
        } 
         
        case 
12: { 
            
ColorChat(idGREEN"[SWE-KUNG]^1 Kill^3 %i^1 players with a Deagle to unlock this achievement!"iAchPoints[DEAGLE]) 
            
ColorChat(idGREEN"[SWE-KUNG]^3 %i/%i."iAchLevel[id][DEAGLE], iAchPoints[DEAGLE]) 
        } 
    } 
    return 
PLUGIN_HANDLED 


public 
CmdStart(id) { 
    if(!
is_user_alive(id)) { 
        return 
FMRES_IGNORED 
    

     
    if(
iAchLevel[id][DISTANCE] <= 2) { 
         
        new 
Float:vecOrigin
        
entity_get_vectoridEV_VEC_originvecOrigin 
     
        if(!
xs_vec_equal(vecOldOrigin[id], vecNullOrigin)) { 
            
flDistance[id] += get_distance_f(vecOriginvecOldOrigin[id]) 
        } 
         
        
xs_vec_copy(vecOriginvecOldOrigin[id]) 
         
        switch(
iAchLevel[id][DISTANCE]) { 
            case 
0: { 
                if(
flDistance[id] / g_iFeet >= 1
                { 
                    
iAchLevel[id][DISTANCE]++ 
                    
ColorChat(idGREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Baby Footsteps!"
                    
emit_sound(idCHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM 
                } 
            } 
            case 
1: { 
                if(
flDistance[id] / g_iFeet >= 5280) { 
                    
iAchLevel[id][DISTANCE]++ 
                    
ColorChat(idGREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Walk Away!"
                    
emit_sound(idCHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM 
                } 
            } 
            case 
2: { 
                if(
flDistance[id] / g_iFeet >= 52800) { 
                    
iAchLevel[id][DISTANCE]++ 
                    
TotalAchievements[id]++ 
                    
ColorChat(idGREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Sprinter!"
                    
emit_sound(idCHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM 
                } 
            } 
        } 
    } 
    return 
FMRES_IGNORED 


public 
client_disconnect(id) { 
    
SaveData(id


public 
SaveData(id)  

    new 
SteamID[32]; get_user_authid(idSteamIDcharsmax(SteamID)) 
    new 
vaultkey[64], vaultdata[256] , iPos  
     
    formatex
(vaultkeycharsmax(vaultkey), "%s-AchievementSystem"SteamID
     
    
iPos num_to_str(TotalAchievements[id], vaultdatacharsmax(vaultdata)) 
    
vaultdata[iPos++] = ' ' 
     
    
for(new iiAchCounti++) { 
        
iPos += formatex(vaultdata[iPos], charsmax(vaultdata) - iPos"%i "iAchLevel[id][i]) 
    } 
    
nvault_set(gVaultvaultkeyvaultdata
}   

public 
LoadData(id)  

    new 
SteamID[35]; get_user_authid(idSteamIDcharsmax(SteamID))  
    new 
vaultkey[64], vaultdata[256], szVal[6
     
    
formatex(vaultkeycharsmax(vaultkey), "%s-AchievementSystem"SteamID)  
     
    
nvault_get(gVaultvaultkeyvaultdatacharsmax(vaultdata)) 
     
    
strbreak(vaultdataszValcharsmax(szVal), vaultdatacharsmax(vaultdata )) 
     
    
TotalAchievements[id] = str_to_num(szVal
     
    for(new 
iiAchCounti++) { 
        
strbreak(vaultdataszVal charsmax(szVal) , vaultdata charsmax(vaultdata))  
        
iAchLevel[id][i] = str_to_num(szVal
    } 

MrKiller2010 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 09:11   Re: Plugin crash "get_user_weapon"
Reply With Quote #2

To correct the error, add a check to make sure the player's id is valid first
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-30-2013 , 09:39   Re: Plugin crash "get_user_weapon"
Reply With Quote #3

Quote:
Originally Posted by YamiKaitou View Post
To correct the error, add a check to make sure the player's id is valid first
Could you code in that? Thanks.
MrKiller2010 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 09:41   Re: Plugin crash "get_user_weapon"
Reply With Quote #4

Quote:
Originally Posted by MrKiller2010 View Post
Could you code in that? Thanks.
Since you are in Scripting Help and gave an non-debugged error, no
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 07-30-2013 at 09:41.
YamiKaitou is offline
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-30-2013 , 09:53   Re: Plugin crash "get_user_weapon"
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
To correct the error, add a check to make sure the player's id is valid first
Quote:
Originally Posted by YamiKaitou View Post
Since you are in Scripting Help and gave an non-debugged error, no
tried with debug it didn't even activate debug...

Code:
L 07/30/2013 - 14:44:04: Info (map "jail_aj_bananamuffin") (file "addons/amxmodx/logs/error_20130730.log")
L 07/30/2013 - 14:44:04: Invalid player id 0
L 07/30/2013 - 14:44:04: [AMXX] Run time error 10 (plugin "Achievements.amxx") (native "get_user_weapon") - debug not enabled!
L 07/30/2013 - 14:44:04: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
L 07/30/2013 - 14:54:45: Start of error session.
L 07/30/2013 - 14:54:45: Info (map "jail_ncc") (file "addons/amxmodx/logs/error_20130730.log")
L 07/30/2013 - 14:54:45: Invalid player id 0
L 07/30/2013 - 14:54:45: [AMXX] Run time error 10 (plugin "Achievements.amxx") (native "get_user_weapon") - debug not enabled!
L 07/30/2013 - 14:54:45: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).

Code:
Achievements.amxx debug
MrKiller2010 is offline
MPD
Member
Join Date: May 2013
Location: Lithuania
Old 07-30-2013 , 09:24   Re: Plugin crash "get_user_weapon"
Reply With Quote #6

Enable debug at first. I think that you have to check wether user is alive or wther it's a user at all before getting his guns in eDeath() function
MPD is offline
Send a message via Skype™ to MPD
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 09:55   Re: Plugin crash "get_user_weapon"
Reply With Quote #7

Did you save and reupload the plugins.ini file? Did you restart the server or change the map?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
MrKiller2010
Senior Member
Join Date: Aug 2012
Old 07-30-2013 , 10:33   Re: Plugin crash "get_user_weapon"
Reply With Quote #8

Quote:
Originally Posted by YamiKaitou View Post
Did you save and reupload the plugins.ini file? Did you restart the server or change the map?
Yes changed around 7-9 maps now..
MrKiller2010 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 07-30-2013 , 10:41   Re: Plugin crash "get_user_weapon"
Reply With Quote #9

Check the output of "rcon amxx plugins", does it have this plugin as debug or running?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-30-2013 , 10:55   Re: Plugin crash "get_user_weapon"
Reply With Quote #10

PHP Code:
new g_iMaxPlayers

{
    
// [...]
    
register_event("DeathMsg""eDeath""a""1>0")
    
// [...]
    
g_iMaxplayers get_maxplayers()
    
// [...]
}
// [...]
public eDeath() {
    new 
killer read_data(1)
    if( 
killer g_iMaxPlayers )
    {
        return
    }
    new 
iWeapon get_user_weapon(killer
Btw, your usage of 'switch' in completely not appropriated, check directly value, for example instead of :
PHP Code:
    switch(iAchLevel[read_data(2)][DIES]) {  
        case 
500: {  
            
TotalAchievements[read_data(2)]++  
            
ColorChat(read_data(2), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Anti-GodMode!")  
            
emit_sound(read_data(2), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM)  
        }  
    } 
->
PHP Code:
    if(iAchLevel[read_data(2)][DIES] == 500) {   
        
TotalAchievements[read_data(2)]++  
        
ColorChat(read_data(2), GREEN"[SWE-KUNG]^1 Congratulations! You have unlocked the achievement:^3 Anti-GodMode!")  
        
emit_sound(read_data(2), CHAN_STATICszAchievementSound1.0ATTN_NORM0PITCH_NORM)  
    } 

Also, do never use read_data(2) more than 1 time, it won't change, do :

new victim = read_data(2), and then use victim in the rest of the function.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 15:48.


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