| Screeaam.. |
12-04-2010 20:18 |
Re: Recorrect my code.
@Emp`
It's helped. Thanks. But I have next problem...
PHP Code:
#include <amxmodx> #include <amxmisc>
#include <engine> #include <superspawns>
#include <fun> #include <cstrike>
#include <colorchat>
#define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author"
#define MAX_PLAYERS 32 #define MAX_SANTA 1
new santa_npc[33]; new bool:have_gift[33];
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 new seq = random_num(0,50) if(SsGetOrigin(origin)) { santa_npc[id] = create_entity("info_target") give_weapon(santa_npc[id])
entity_set_origin(santa_npc[id],origin);
entity_set_float(santa_npc[id],EV_FL_takedamage,0.0) entity_set_float(santa_npc[id],EV_FL_health,100.0)
entity_set_string(santa_npc[id],EV_SZ_classname,"npc_santa"); entity_set_model(santa_npc[id],"models/mikolaj.mdl"); entity_set_int(santa_npc[id],EV_INT_solid, 2)
entity_set_byte(santa_npc[id],EV_BYTE_controller1,125); entity_set_byte(santa_npc[id],EV_BYTE_controller2,125); entity_set_byte(santa_npc[id],EV_BYTE_controller3,125); entity_set_byte(santa_npc[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(santa_npc[id],mins,maxs)
entity_set_float(santa_npc[id],EV_FL_animtime,2.0) entity_set_float(santa_npc[id],EV_FL_framerate,1.0) entity_set_int(santa_npc[id],EV_INT_sequence,seq);
entity_set_float(santa_npc[id],EV_FL_nextthink,halflife_time() + 0.01)
drop_to_floor(santa_npc[id]) return 1; } else { server_print("No free location") } return PLUGIN_CONTINUE; }
public scan() { SsInit(3500.0) SsScan() SsDump()
for(new id=1;id<=MAX_SANTA;id++) { set_task(5.0, "santa", id+666) } }
public Round_End(){ for(new id=1;id<=32;id++) { remove_entity(santa_npc[id]) have_gift[id] = false; } }
public Round_Start(){ for(new id=1;id<=32;id++) { remove_entity(santa_npc[id]) } set_task(5.0, "scan") }
public npc_think(ent) { entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01) new Float:npcorigin[3] entity_get_vector(ent, EV_VEC_origin, npcorigin) new Float:playerOrigin[3] for (new i=1; i < MAX_PLAYERS; i++) { if (!is_user_connected(i) || !is_user_alive(i)) continue; pev(i,pev_origin,playerOrigin) if (get_distance_f(npcorigin, playerOrigin) < 150.0) { if(have_gift[i] == false) { new random = random_num(1,6) switch(random) { case 1: { client_print(i, print_center,"Gift number 1.") have_gift[i] = true; } case 2: { client_print(i, print_center,"Gift number 2.") have_gift[i] = true; } case 3: { client_print(i, print_center,"Gift number 3.") have_gift[i] = true; } case 4: { client_print(i, print_center,"Gift number 4.") have_gift[i] = true; } } } else if(have_gift[i] == false) { client_print(i, print_center,"You have a gift") } } } return PLUGIN_CONTINUE; }
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") }
I need to have only one model spawned per round. But with that code I have two models at round, and one of it don't remove at end round, why?
|