AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NPC help. (https://forums.alliedmods.net/showthread.php?t=96052)

Mr.Noobie 06-30-2009 08:24

NPC help.
 
Can someone provide me some code for blood and death animation on NPC ?

How can i make the NPC move ?? + how do i make only admin with access flag "A" to use the command ??

PHP Code:

#include <amxmodx>
#include <engine>
 
public plugin_init() 
{
        
register_clcmd("vip""spawn_npc")
        
register_plugin("NPC","1.0","Mr.Noobie")
        
register_think("npc_vip","npc_think")
}
 
public 
plugin_precache()
{
    
precache_model("models/player/vip/vip.mdl")
    
precache_model("models/p_ak47.mdl")
}
 
public 
spawn_npc(id)
{
    new 
Float:origin[3]
    
entity_get_vector(id,EV_VEC_origin,origin)
    new 
ent create_entity("info_target")
    
give_weapon(ent)
    
entity_set_origin(ent,origin)
    
origin[2] += 300.0
    entity_set_origin
(id,origin)
    
entity_set_float(ent,EV_FL_takedamage,1.0)
    
entity_set_float(ent,EV_FL_health,100.0)
    
entity_set_string(ent,EV_SZ_classname,"npc_vip")
    
entity_set_model(ent,"models/player/vip/vip.mdl")
    
entity_set_int(ent,EV_INT_solid2)
    
entity_set_byte(ent,EV_BYTE_controller1,125)
    
entity_set_byte(ent,EV_BYTE_controller2,125)
    
entity_set_byte(ent,EV_BYTE_controller3,125)
    
entity_set_byte(ent,EV_BYTE_controller4,125)
    new 
Float:maxs[3] = {16.0,16.0,36.0}
    new 
Float:mins[3] = {-16.0,-16.0,-36.0}
    
entity_set_size(ent,mins,maxs)
    
entity_set_float(ent,EV_FL_animtime,2.0)
    
entity_set_float(ent,EV_FL_framerate,1.0)
    
entity_set_int(ent,EV_INT_sequence,0)
    
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01)
    
drop_to_floor(ent)
    return 
1
}
 
public 
give_weapon(ent)
{
        new 
entWeapon create_entity("info_target")
        
entity_set_string(entWeaponEV_SZ_classname"npc_weapon")
        
entity_set_int(entWeaponEV_INT_movetypeMOVETYPE_FOLLOW)
        
entity_set_int(entWeaponEV_INT_solidSOLID_NOT)
        
entity_set_edict(entWeaponEV_ENT_aimentent)
        
entity_set_model(entWeapon"models/p_ak47.mdl"
}
 
public 
npc_think(id)
{
    
entity_set_float(id,EV_FL_nextthink,halflife_time() + 0.01)




All times are GMT -4. The time now is 15:26.

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