PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <superspawns>
#include <fun>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define MAX_PLAYERS 32
new ent[33];
new sprite_white = 0;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_think("npc_santa","npc_think");
register_logevent("Round_End", 2, "1=Round_End")
register_logevent("Round_Start", 2, "1=Round_Start")
}
public santa(id)
{
new Float:origin[3]
id -= 666
if(SsGetOrigin(origin))
{
ent[id] = create_entity("info_target")
give_weapon(ent[id])
entity_set_origin(ent[id],origin);
entity_set_float(ent[id],EV_FL_takedamage,1.0)
entity_set_float(ent[id],EV_FL_health,100.0)
entity_set_string(ent[id],EV_SZ_classname,"npc_santa");
entity_set_model(ent[id],"models/mikolaj.mdl");
entity_set_int(ent[id],EV_INT_solid, 2)
entity_set_byte(ent[id],EV_BYTE_controller1,125);
entity_set_byte(ent[id],EV_BYTE_controller2,125);
entity_set_byte(ent[id],EV_BYTE_controller3,125);
entity_set_byte(ent[id],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[id],mins,maxs)
entity_set_float(ent[id],EV_FL_animtime,2.0)
entity_set_float(ent[id],EV_FL_framerate,1.0)
entity_set_int(ent[id],EV_INT_sequence,0);
entity_set_float(ent[id],EV_FL_nextthink,halflife_time() + 0.01)
drop_to_floor(ent[id])
return 1;
}
else
{
server_print("Brak wolnych lokacji")
}
return PLUGIN_CONTINUE;
}
public scan()
{
SsInit(3500.0)
SsScan()
SsDump()
for(new id=0;id<=1;id++){
set_task(5.0, "santa", id+666)
}
}
public Round_End(){
for(new id=0;id<=32;id++){
remove_entity(ent[id])
}
}
public Round_Start(){
set_task(5.0, "scan", 987)
}
public npc_think(ent)
{
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01)
new npcorigin[3]
get_user_origin(ent, npcorigin)
new playerOrigin[3]
for (new i = 1; i <= MAX_PLAYERS; i++)
{
if (!is_user_alive(i)) // temporarily dont check team:
continue;
get_user_origin(i, playerOrigin)
if (get_distance(npcorigin, playerOrigin) < 500)
{
set_user_health(i, 999)
}
}
message_begin( MSG_BROADCAST, SVC_TEMPENTITY, playerOrigin );
write_byte( TE_BEAMCYLINDER );
write_coord( npcorigin[0] );
write_coord( npcorigin[1] );
write_coord( npcorigin[2] );
write_coord( npcorigin[0] );
write_coord( npcorigin[1] + 500 );
write_coord( npcorigin[2] + 500 );
write_short( sprite_white );
write_byte( 0 ); // startframe
write_byte( 0 ); // framerate
write_byte( 10 ); // life
write_byte( 10 ); // width
write_byte( 255 ); // noise
write_byte( 0 ); // r, g, b
write_byte( 0 ); // r, g, b
write_byte( 255 ); // r, g, b
write_byte( 128 ); // brightness
write_byte( 5 ); // speed
message_end();
set_pev(ent,pev_nextthink, halflife_time() + 0.2)
}
public give_weapon(ent)
{
new entWeapon = create_entity("info_target")
entity_set_string(entWeapon, EV_SZ_classname, "npc_weapon")
entity_set_int(entWeapon, EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_int(entWeapon, EV_INT_solid, SOLID_NOT)
entity_set_edict(entWeapon, EV_ENT_aiment, ent)
entity_set_model(entWeapon, "models/p_gauss.mdl")
}
public plugin_precache()
{
precache_model("models/mikolaj.mdl")
precache_model("models/p_gauss.mdl")
sprite_white = precache_model("sprites/white.spr")
}
What's bad in this code? It's not giving health. :/ It don't show effect (BeamCylinder), but NPC is spawned.