Raised This Month: $ Target: $400
 0% 

Set es problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 12-07-2011 , 12:26   Set es problem
Reply With Quote #1

i want create plugin with addtofullpack
If show cvar enabled player can show entities

BUt dont work
set_es(es, ES_Effects, get_es(es, ES_Effects) & ~EF_NODRAW);

code:
Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0.0"
#define AUTHOR "HoLLyWooD"

#define smodel 		"models/winebottle.mdl"
#define ent_class 	"present_spawn_point"

new bool:show = false;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_forward(FM_AddToFullPack, "addToFullPackPre", 0);
	
	register_clcmd("say new_ent", "create_ent");
	register_clcmd("say show_ent", "cmd_show");
}

public plugin_precache()
	precache_model(smodel);

public cmd_show(id){
	show = (show) ? false : true;
	client_print(id, print_chat, (show) ? "You can show entities" : "You can`t show entities");
}

public create_ent(id){
	new Float:origin[3], ent, classname[32], bool:is_ent = false;
	entity_get_vector(id, EV_VEC_origin, origin);
	
	while( (ent = find_ent_in_sphere(ent, origin, 100.0)) != 0 ){
		entity_get_string(ent,EV_SZ_classname,classname,charsmax(classname));
		
		if(equali(classname,ent_class)){
			is_ent = true;
			break;
		}
	}
	
	if(is_ent){
		client_print(id, print_center, "Some entity is in 100 radius");
		return;
	}
	
	ent = create_entity("info_target");
	entity_set_string(ent,EV_SZ_classname, ent_class);
	entity_set_model(ent,smodel);
	entity_get_vector(id, EV_VEC_origin, origin);
	entity_set_origin(ent,origin);
	entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER);
	set_rendering(ent, kRenderFxGlowShell, 0,255, 0, kRenderNormal, 16 );
	entity_set_int(ent, EV_INT_effects, entity_get_int(ent, EV_INT_effects) | EF_NODRAW);
	drop_to_floor(ent);
	
	client_print(id, print_chat, "Invisible entity created!");
}

public addToFullPackPre(es, e, ent, host, hostflags, player, pSet){
	if(!show || !is_valid_ent(ent))
		return FMRES_IGNORED;
	
	new classname[32];
	entity_get_string(ent, EV_SZ_classname, classname, 31);
		
	if(equali(classname, ent_class))
		set_es(es, ES_Effects, get_es(es, ES_Effects) & ~EF_NODRAW);
		
	return FMRES_IGNORED;
}
__________________

You do not know what to tell? Keep silent! You will look cleverer!
Не знаешь что сказать? Промолчи! Будешь выглядеть умней!
Статьи по скриптингу: НА РУССКОМ
HoLLyWooD is offline
 



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 20:52.


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