PHP Code:
/*
----------------------------
Description
----------------------------
A Zombie Class for Zombie Plague Mod( Dummy Zombie )
What can this do?
* Liez to them and backstab them :D
* Trap them
----------------------------
Update Logs
----------------------------
v1.0 - Intial Release
----------------------------
Suggestions & Bug reporting
----------------------------
1. PM( Private Message ) me( Recommended, I online very often. )
----------------------------
Credits
----------------------------
007 -> Re-edited it to a zombie :|
Twilight Suzuka -> NPC Plug-in( https://forums.alliedmods.net/showthread.php?t=11756 )
01101101 -> Removing entity on Round Start( https://forums.alliedmods.net/showpost.php?p=1071507&postcount=3 )
----------------------------
*/
#include < amxmodx >
#include < engine >
#include < zombieplague >
new const zclass_name[ ] = "Illusion Zombie"
new const zclass_info[ ] = "Make Dummy [E]"
new const zclass_model[ ] = "za_fleshpound"
new const zclass_clawmodel[ ] = "v_knife_zombie_fleshpound.mdl"
const zclass_health = 2000
const zclass_speed = 200
const Float:zclass_gravity = 1.0
const Float:zclass_knockback = 0.5
// Models
new const dummy_model[ ] = "models/player/za_fleshpound/za_fleshpound.mdl"
new g_zclass_dummy, gCvarDummyShouldDie, gCvarDummyHealth, gCvarDummyAnimation, gCvarDummyLimit
// Prevents people from spamming
new gCounter[ 33 ]
public plugin_init( )
{
register_plugin( "[ZP] Zombie Class: Dummy Zombie", "1.0", "007 & Twilight Suzuka & 01101101" )
register_think( "npc_dummy","npc_think" )
register_event( "HLTV", "event_new_round", "a", "1=0", "2=0" )
gCvarDummyShouldDie = register_cvar( "zp_dummy_should_die", "1" ) // ( 0 : Dummy will not die || 1: Dummy will die ) Default: 1
gCvarDummyHealth = register_cvar( "zp_dummy_health", "100" ) // Dummy's health Default: 100
gCvarDummyAnimation = register_cvar( "zp_dummy_animation", "1" ) // ( 0 : Dummy floating animation || 1: Dummy standing animation ) Default: 1
gCvarDummyLimit = register_cvar( "zp_dummy_spawn_limit", "5" ) // Amount of dummy he can spawn when he gets infected
// NOTE: If he antidotes and get infected again he can spawn dummies again.
}
public plugin_precache( )
{
g_zclass_dummy = zp_register_zombie_class( zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback )
precache_model( dummy_model )
}
public zp_user_infected_pre(id) {
if(!(get_user_flags(id) & ADMIN_LEVEL_C)) {
if (zp_get_user_next_class(id) == g_zclass_dummy) {
zp_set_user_zombie_class(id, 0)
client_print(id, print_center, "Klasa koju si odabrao je samo za *HEAD* Admine.")
client_print(id, print_chat, "Odabrana klasa je samo za *HEAD* Admine. Bice promenjena na The Undead.")
}
}
}
// Thanks 01101101( Removing entity )
public event_new_round( )
{
new ent = -1
while( ( ent = find_ent_by_class( ent, "npc_dummy" ) ) )
{
remove_entity( ent )
}
}
public client_PreThink( id )
{
if( !is_user_alive( id ) || !zp_get_user_zombie( id ) || zp_get_user_zombie_class( id ) != g_zclass_dummy || zp_get_user_nemesis( id ) || zp_get_user_survivor( id ) )
return PLUGIN_HANDLED
// No more slowhacking!
new button = get_user_button( id )
new oldbutton = get_user_oldbutton( id )
if( !( oldbutton & IN_USE ) && ( button & IN_USE ) )
create_dummy( id )
return PLUGIN_HANDLED
}
public zp_user_infected_post( id, infector )
{
if( zp_get_user_zombie_class( id ) == g_zclass_dummy && !zp_get_user_nemesis( id ) )
{
gCounter[ id ] = 0
client_print( id, print_chat, "[ZP] Press your ^"+use^" button to build a dummy!" )
}
}
public create_dummy( id )
{
if( gCounter[ id ] >= get_pcvar_num( gCvarDummyLimit ) )
{
client_print( id, print_chat, "[ZP] Достигнут лимит илюзии!" )
return PLUGIN_HANDLED
}
new Float:origin[ 3 ]
entity_get_vector( id, EV_VEC_origin,origin )
new ent = create_entity( "info_target" )
entity_set_origin( ent, origin )
origin[ 1 ] += 50.0
entity_set_origin( id,origin )
entity_set_float( ent, EV_FL_takedamage, get_pcvar_float( gCvarDummyShouldDie ) )
entity_set_float( ent, EV_FL_health, get_pcvar_float( gCvarDummyHealth ) )
entity_set_string( ent, EV_SZ_classname, "npc_dummy" )
entity_set_model( ent, dummy_model )
entity_set_int( ent, EV_INT_solid, 2 )
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, get_pcvar_num( gCvarDummyAnimation ) )
entity_set_float( ent,EV_FL_nextthink, halflife_time( ) + 0.01 )
drop_to_floor( ent )
gCounter[ id ] ++
client_print( id, print_chat, "[ZP] You've used %d / %d dummies.", gCounter[ id ], get_pcvar_num( gCvarDummyLimit ) )
return 1
}
public npc_think( id )
{
entity_set_float( id, EV_FL_nextthink, halflife_time( ) + 0.01 )
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/