Raised This Month: $ Target: $400
 0% 

host_error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoviuX
Senior Member
Join Date: Jun 2009
Location: Lithuania
Old 05-30-2010 , 08:02   host_error
Reply With Quote #1

I get this error:

Code:
Host_Error: PF_precache_model_I: 'models/w_medkit.mdl' Precache can only
be done in spawn functions.
Code:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

new CLASSNAME[] = "item_healthkit"

#define ACCESS_LEVEL ADMIN_CFG

new const g_medkit_pickup[] = "umbrella/medkit_pickup.wav"

new boolg_zombie[33]
new 
boolg_human[33]
new 
g_medkit[33]

new 
FILE[96]

public 
plugin_init()
{
    
register_touch("my_entity""player""medkit_pickup"
    
register_clcmd("healthkit_spawn""cmd_healthkit_spawn"ACCESS_LEVEL"[save]")
    
register_concmd("healthkit_load""cmd_healthkit_load"ACCESS_LEVEL"<x> <y> <z>")
    
register_concmd("healthkit_clear""cmd_healthkit_clear"ACCESS_LEVEL)

    
register_forward(FM_Touch"fw_medkit_pickup")

    new 
configs_dir[64], map[32]
    
get_configsdir(configs_dir63)
    
get_mapname(map31)
    
format(FILE95"%s/maps/%s.cfg"configs_dirmap)
}

public 
plugin_precache()
{
    
precache_sound(g_medkit_pickup)
}

public 
fw_medkit_pickup(pToucherpTouchedclient)
{
    if ( 
pev_valid(pToucher))
    {
        static 
className[32], className2[32]
        
pev(pToucherpev_classnameclassName31)
        if ( 
pev_valid(pTouched)) pev(pTouchedpev_classnameclassName231)
        
        if ( 
equal(classNameCLASSNAME))
        {
            if ( 
pev_valid(pTouched))
            {
                if ( 
equal(className2"player") && is_user_connected(pTouched))
                {
                    static 
origin[3]
                    
get_user_origin(pTouchedorigin)
                    
                    if(
g_zombie[pToucher])
                    {
                        return 
PLUGIN_HANDLED
                    
}
                    else if(
g_human[pToucher])
                    {
                        
emit_sound(clientCHAN_ITEMg_medkit_pickup1.0ATTN_NORM0PITCH_NORM);
                        
g_medkit[client] = true
                    }
                    
                }
            }        
            
engfunc(EngFunc_RemoveEntitypToucher)
        }
    }
    return 
FMRES_IGNORED
}

public 
cmd_healthkit_spawn(idlevelcid) {
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    emit_sound
(idCHAN_ITEMg_medkit_pickup1.0ATTN_NORM0PITCH_NORM);

    new 
origin[3]
    
get_user_origin(idorigin)
    
healthkit_spawn(origin

    new 
arg1[6]
    
read_argv(1arg15)
    if (!
equali(arg1"save"))
        return 
PLUGIN_HANDLED

    
new command[48]
    
format(command47"healthkit_load %d %d %d"origin[0], origin[1], origin[2])
    
write_file(FILEcommand)

    return 
PLUGIN_HANDLED
}

public 
cmd_healthkit_load(idlevelcid) {
    if (!
cmd_access(idlevelcid4))
        return 
PLUGIN_HANDLED

    
new arg1[8], arg2[8], arg3[8], origin[3]
    
read_argv(1arg17)
    
read_argv(2arg27)
    
read_argv(3arg37)
    
origin[0] = str_to_num(arg1)
    
origin[1] = str_to_num(arg2)
    
origin[2] = str_to_num(arg3)
    
healthkit_spawn(origin)

    return 
PLUGIN_HANDLED
}

public 
cmd_healthkit_clear(idlevelcid) {
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    
new healthkit = -1
    
while ((healthkit find_ent_by_class(healthkitCLASSNAME)))
        
remove_entity(healthkit)

    return 
PLUGIN_HANDLED
}

healthkit_spawn(origin[3]) {
    new 
healthkit create_entity(CLASSNAME)
    if (!
healthkit)
        return

    new 
Float:vec[3]
    
IVecFVec(originvec)
    
entity_set_origin(healthkitvec)
    
DispatchSpawn(healthkit)

DoviuX is offline
Send a message via Skype™ to DoviuX
killer007774
New Member
Join Date: Mar 2010
Location: Sweden
Old 06-05-2010 , 15:29   Re: host_error
Reply With Quote #2

Are you sure you got the Model?
killer007774 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 05:25.


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