Raised This Month: $344 Target: $400
 86%   Almost there!

OnWeapon_Precache error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tripaloski
Member
Join Date: Jul 2017
Old 08-08-2017 , 21:05   OnWeapon_Precache error
Reply With Quote #1

Hi everyone.
I'm having the following error in the logs.
Error:
PHP Code:
L 08/08/2017 02:21:36: [HAMSANDWICHFailed to retrieve classtype for ""hook for "OnWeapon_Precache" not active.
L 08/08/2017 02:21:36: [AMXXDisplaying debug trace (plugin "NoCustumeSkins.amxx")
L 08/08/2017 02:21:36: [AMXXRun time error 10native error (native "RegisterHam")
L 08/08/2017 02:21:36: [AMXXNoCustumeSkins.sma::plugin_precache (line 80
Line 80
PHP Code:
        g_hPrecacheHook[iWeaponId] = RegisterHam(Ham_PrecacheszWeaponName"OnWeapon_Precache"
PHP Code:
public plugin_precache()
{
    new 
szWeaponName[32]
    for(new 
iWeaponId 1iWeaponId < (MAX_WEAPONS); iWeaponId++) if(iWeaponId != 2)
    {
        
get_weaponname(iWeaponIdszWeaponNamecharsmax(szWeaponName))
        
        
g_hPrecacheHook[iWeaponId] = RegisterHam(Ham_PrecacheszWeaponName"OnWeapon_Precache")
        
g_hPrecacheHook_Post[iWeaponId] = RegisterHam(Ham_PrecacheszWeaponName"OnWeapon_Precache_Post"true)
    }

Does anyone know how to solve it?

Last edited by Tripaloski; 08-08-2017 at 21:05.
Tripaloski is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-09-2017 , 02:30   Re: OnWeapon_Precache error
Reply With Quote #2

public plugin_precache()
{
new szWeaponName[32]
for(new iWeaponId = 1; iWeaponId <= (CZW_P90); iWeaponId++) if(iWeaponId != 2)
{
get_weaponname(iWeaponId, szWeaponName, charsmax(szWeaponName))
if(szWeapon[0] == EOS) continue;
g_hPrecacheHook[iWeaponId] = RegisterHam(Ham_Precache, szWeaponName, "OnWeapon_Precache")
g_hPrecacheHook_Post[iWeaponId] = RegisterHam(Ham_Precache, szWeaponName, "OnWeapon_Precache_Post", true)
}
}
__________________
@Jailbreak Main Mod v2.6.6 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-09-2017 , 05:00   Re: OnWeapon_Precache error
Reply With Quote #3

get_weaponname is not going to work in precache on first map. The solution is probably to hardcode a list of weapon classnames and use them.
__________________
HamletEagle is offline
leonardo121
Member
Join Date: Sep 2013
Old 08-09-2017 , 07:44   Re: OnWeapon_Precache error
Reply With Quote #4

use a const with all weapon classname
__________________
" In the end it doesn't even matter " - Linkin Park
leonardo121 is offline
Tripaloski
Member
Join Date: Jul 2017
Old 08-09-2017 , 09:04   Re: OnWeapon_Precache error
Reply With Quote #5

HamletEagle.
Sorry but I do not know how to get it to work properly.
Can you help?
Tripaloski is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-09-2017 , 09:14   Re: OnWeapon_Precache error
Reply With Quote #6

Quote:
Originally Posted by leonardo121 View Post
use a const with all weapon classname
Just write manually all weapon names in a constant and loop over that.
PHP Code:
new const Something[][] = 
{
   ....
}

for()
{
  ....
code

__________________
HamletEagle is offline
leonardo121
Member
Join Date: Sep 2013
Old 08-09-2017 , 09:23   Re: OnWeapon_Precache error
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
Just write manually all weapon names in a constant and loop over that.
PHP Code:
new const Something[][] = 
{
   ....
}

for()
{
  ....
code

yhea like this
__________________
" In the end it doesn't even matter " - Linkin Park
leonardo121 is offline
Tripaloski
Member
Join Date: Jul 2017
Old 08-09-2017 , 09:43   Re: OnWeapon_Precache error
Reply With Quote #8

This?

PHP Code:
new const Something[][] =  

    
CSW_P228,       
    
CSW_SCOUT,       
    
CSW_HEGRENADE,      
    
CSW_XM1014,        
    
CSW_C4,           
    
CSW_MAC10,       
    
CSW_AUG,          
    
CSW_SMOKEGRENADE,  
    
CSW_ELITE,       
    
CSW_FIVESEVEN,      
    
CSW_UMP45,      
    
CSW_SG550,       
    
CSW_GALIL,       
    
CSW_FAMAS,      
    
CSW_USP,       
    
CSW_GLOCK18,      
    
CSW_AWP,          
    
CSW_MP5NAVY,       
    
CSW_M249,       
    
CSW_M3,           
    
CSW_M4A1,        
    
CSW_TMP,          
    
CSW_G3SG1,       
    
CSW_FLASHBANG,    
    
CSW_DEAGLE,        
    
CSW_SG552,        
    
CSW_AK47,       
    
CSW_KNIFE,      
    
CSW_P90           

Tripaloski is offline
leonardo121
Member
Join Date: Sep 2013
Old 08-09-2017 , 09:49   Re: OnWeapon_Precache error
Reply With Quote #9

Quote:
get_weaponname(iWeaponId, szWeaponName, charsmax(szWeaponName))
pick up the name not the ID
here it is
https://wiki.alliedmods.net/Cs_weapons_information
__________________
" In the end it doesn't even matter " - Linkin Park
leonardo121 is offline
Tripaloski
Member
Join Date: Jul 2017
Old 08-09-2017 , 09:55   Re: OnWeapon_Precache error
Reply With Quote #10

Is it already correct?

PHP Code:
new const Something[][] =  

    
"weapon_p228",            
    
"weapon_scou",             
    
"weapon_hegrenade",               
    
"weapon_xm1014",
    
"weapon_c4",    
    
"weapon_mac10",         
    
"weapon_aug",
    
"weapon_smokegrenade",       
    
"weapon_elite",         
    
"weapon_fiveseven",
    
"weapon_ump45",         
    
"weapon_sg550"
    
"weapon_galil",
    
"weapon_famas"
    
"weapon_usp",   
    
"weapon_glock18",    
    
"weapon_awp",  
    
"weapon_mp5navy",      
    
"weapon_m249",              
    
"weapon_m3"
    
"weapon_m4a1",      
    
"weapon_tmp",      
    
"weapon_g3sg1",
    
"weapon_flashbang",   
    
"weapon_deagle",
    
"weapon_sg552",
    
"weapon_ak47",   
    
"weapon_knife",                 
    
"weapon_p90"

Tripaloski 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 11:50.


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