AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   setting EF_NODRAW on a player (rendering them with no alpha wont work) (https://forums.alliedmods.net/showthread.php?t=127400)

HLM 05-20-2010 16:13

setting EF_NODRAW on a player (rendering them with no alpha wont work)
 
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fun>
#include <fakemeta>

#define PLUGIN "Block Spy Invisible Sniping"
#define VERSION "1.0"
#define AUTHOR "Master"

new m_LaserBeam //= precache_model("sprites/laserbeam.spr");

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_CmdStart"fwdCmdStart");
}

public 
plugin_precache()
    
m_LaserBeam precache_model("sprites/laserbeam.spr");


public 
fwdCmdStart(iduc_handleuc_seed)
{
    new 
NoDraw pev(id,pev_effectsEF_NODRAW);
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    
    static 
iButton;
    
iButton get_uc(uc_handleUC_Buttons);
    
    
    if(~
iButton IN_ATTACK)
    {
        if(
pev_valid(NoDraw))
        {
            new 
origin[3]
            
get_user_origin(idorigin0)
            
//do stuff
            
message_begin(MSG_PVSSVC_TEMPENTITYoriginid)
            
write_byteTE_BEAMCYLINDER );
            
write_coordorigin[0] );
            
write_coordorigin[1] );
            
write_coordorigin[2] );
            
write_coordorigin[0] );
            
write_coordorigin[1] );
            
write_coordorigin[2] + 512 );
            
write_shortm_LaserBeam );
            
write_byte); // startframe
            
write_byte); // framerate
            
write_byte); // life
            
write_byte);  // width
            
write_byte);   // noise
            
write_byte255 );   // r, g, b
            
write_byte255 );   // r, g, b
            
write_byte255 );   // r, g, b
            
write_byte128 ); //brightness
            
write_byte);        // speed
            
message_end();
            
            
//pEntity->v.effects |= EF_NODRAW;
            
set_pev(id,pev_effects, &~EF_NODRAW);
            
//set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25); THIS FAILS TO WORK
        
}
    }
    return 
FMRES_IGNORED;


I dont know how to do it :(

Exolent[jNr] 05-20-2010 19:40

Re: setting EF_NODRAW on a player (rendering them with no alpha wont work)
 
set_entity_visibility() and get_entity_visibility() in engine_stocks.inc

HLM 05-20-2010 19:53

Re: setting EF_NODRAW on a player (rendering them with no alpha wont work)
 
okay, thanks exolent, but my code is failing to work, it will keep resetting invisibility when someone is NOT holding attack key, which is the opposite of what I was aiming for, I want to set the user as visible when they are previously invisible and are holding the attack key. (if that makes sense)

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <engine>
#include <fun>
#include <fakemeta>

#define PLUGIN "Block Spy Invisible Sniping"
#define VERSION "1.0"
#define AUTHOR "Master"

new m_LaserBeam //= precache_model("sprites/laserbeam.spr");

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_CmdStart"fwdCmdStart");
    
}

public 
plugin_precache()
    
m_LaserBeam precache_model("sprites/laserbeam.spr");


public 
fwdCmdStart(iduc_handleuc_seed)
{
    if(!
is_user_alive(id))
        return 
FMRES_IGNORED;
    
    static 
iButton;
    
iButton get_uc(uc_handleUC_Buttons);
    
//new NoDraw = pev(id, pev_effects, EF_NODRAW)
    
    
if(~iButton IN_ATTACK)
    {
        if(!
get_entity_visibility(id))
        {
            
            new 
origin[3]
            
get_user_origin(idorigin0)
            
//do stuff
            
message_begin(MSG_PVSSVC_TEMPENTITYoriginid)
            
write_byteTE_BEAMCYLINDER );
            
write_coordorigin[0] );
            
write_coordorigin[1] );
            
write_coordorigin[2] );
            
write_coordorigin[0] );
            
write_coordorigin[1] );
            
write_coordorigin[2] + 512 );
            
write_shortm_LaserBeam );
            
write_byte); // startframe
            
write_byte); // framerate
            
write_byte); // life
            
write_byte);  // width
            
write_byte);   // noise
            
write_byte255 );   // r, g, b
            
write_byte255 );   // r, g, b
            
write_byte255 );   // r, g, b
            
write_byte128 ); //brightness
            
write_byte);        // speed
            
message_end();
            
            
            
//pEntity->v.effects |= EF_NODRAW;
            //set_pev(id,pev_effects, & ~EF_NODRAW);
            //set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderNormal,25); //THIS FAILS TO WORK
            
set_entity_visibility(id1)
        }
    }
    return 
FMRES_IGNORED;



Exolent[jNr] 05-20-2010 19:59

Re: setting EF_NODRAW on a player (rendering them with no alpha wont work)
 
So only show the player when the player is attacking?

HLM 05-20-2010 20:46

Re: setting EF_NODRAW on a player (rendering them with no alpha wont work)
 
yes, and I already have the part of the plugin where the player is invisible otherwise


All times are GMT -4. The time now is 03:42.

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