Raised This Month: $ Target: $400
 0% 

Set es problem


Post New Thread Reply   
 
Thread Tools Display Modes
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
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-07-2011 , 12:40   Re: Set es problem
Reply With Quote #2

Either you register the forward as post and you set es effect like you tried, either you let it as pre and you only have to supercede it.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 12-07-2011 , 14:04   Re: Set es problem
Reply With Quote #3

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_SUPERCEDE;
	}
		
	return FMRES_IGNORED;
}
dont work
__________________

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

Last edited by HoLLyWooD; 12-07-2011 at 14:04.
HoLLyWooD is offline
HoLLyWooD
Senior Member
Join Date: Nov 2010
Location: Ukraine Krivoy Rog
Old 12-08-2011 , 03:44   Re: Set es problem
Reply With Quote #4

i try create invisible entity with modelindex - but isn`t work

PHP 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;
new 
modelindex;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_forward(FM_AddToFullPack"addToFullPackPre"0);
    
    
register_clcmd("say new""create_ent");
    
register_clcmd("say show""cmd_show");
}

public 
plugin_precache()
    
modelindex engfunc(EngFunc_PrecacheModelsmodel);
    
//precache_model(smodel);

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

public 
create_ent(id){
    new 
Float:origin[3], entclassname[32], bool:is_ent false;
    
entity_get_vector(idEV_VEC_originorigin);
    
    while( (
ent find_ent_in_sphere(entorigin100.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(idprint_center"Some entity is in 100 radius");
        return;
    }
    
    
ent create_entity("info_target");
    
entity_set_string(ent,EV_SZ_classnameent_class);
    
//entity_set_int(ent, EV_INT_modelindex, modelindex);
    //entity_set_model(ent,smodel);
    
entity_get_vector(idEV_VEC_originorigin);
    
entity_set_origin(ent,origin);
    
entity_set_int(entEV_INT_solidSOLID_TRIGGER);
    
set_rendering(entkRenderFxGlowShell0,2550kRenderNormal16 );
    
//entity_set_int(ent, EV_INT_effects, entity_get_int(ent, EV_INT_effects) | EF_NODRAW);
    
drop_to_floor(ent);
    
    
client_print(idprint_chat"Invisible entity created!");
}

public 
addToFullPackPre(eseenthosthostflagsplayerpSet){
    if(!
show || !is_valid_ent(ent))
        return 
FMRES_IGNORED;
    
    new 
classname[32];
    
entity_get_string(entEV_SZ_classnameclassname31);
        
    if(
equali(classnameent_class)){
        
set_es(esES_ModelIndexmodelindex);
        
//set_es(es, ES_Effects, 0);
        
return FMRES_SUPERCEDE;
    }
        
    return 
FMRES_IGNORED;

__________________

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

Last edited by HoLLyWooD; 12-08-2011 at 03:44.
HoLLyWooD is offline
Reply



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