Raised This Month: $ Target: $400
 0% 

Render flashlight for only that player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Y060N
BANNED
Join Date: Dec 2011
Location: www.equilibriumcs.com
Old 04-18-2012 , 11:29   Render flashlight for only that player
Reply With Quote #1

When my server is full (zombie server), many people will get FPS lag from others using flashlights. I was wondering if it is possible to only render the flashlight for that specific player using it, rather than have it server wide.

If it is, I was wondering how you'd go about doing that.

Many thanks in advanced.

Last edited by Y060N; 04-18-2012 at 11:30.
Y060N is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 04-18-2012 , 12:14   Re: Render flashlight for only that player
Reply With Quote #2

I remember that in last version of ZP was a CVAR for a flashlight..I think it was zp_flashlight_show_all 0 or something....
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 04-18-2012 , 13:26   Re: Render flashlight for only that player
Reply With Quote #3

Quote:
Originally Posted by Y060N View Post
When my server is full (zombie server), many people will get FPS lag from others using flashlights. I was wondering if it is possible to only render the flashlight for that specific player using it, rather than have it server wide.

If it is, I was wondering how you'd go about doing that.

Many thanks in advanced.
Check out my thread, i already made it. It using addtofullpack forward by the way.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-20-2012 , 01:15   Re: Render flashlight for only that player
Reply With Quote #4

Quote:
Originally Posted by yokomo View Post
Check out my thread, i already made it. It using addtofullpack forward by the way.
You forgot to optimize it though.

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"
#define PLUGIN "Personal FlashLight"

new g_iMaxPlayers
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_forward(FM_AddToFullPack"AddToFullPack_Post"true)
    
register_forward(FM_EmitSound"EmitSound"false)
    
g_iMaxPlayers get_maxplayers()
}

// int  )            (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
public AddToFullPack_Post(eseentidhostflagsplayer )
{
    static 
bitEffects
    
if(    player
    
&&    ent != id
    
&&    get_orig_retval()
    &&    (
bitEffects get_es(esES_Effects)) & EF_DIMLIGHT    )
    {
        
set_es(esES_EffectsbitEffects & ~EF_DIMLIGHT)
    }
}

//EmitSound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
// void )            (edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
public EmitSound(idchannel, const sample[])
{
    if( 
IsPlayer(id) && channel == CHAN_ITEM && equal(sample"items/flashlight1.wav") )
    {
        
client_cmd(id"spk items/flashlight1.wav")
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-20-2012 at 01:15.
ConnorMcLeod is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 04-20-2012 , 03:05   Re: Render flashlight for only that player
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
You forgot to optimize it though.

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"
#define PLUGIN "Personal FlashLight"

new g_iMaxPlayers
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_forward(FM_AddToFullPack"AddToFullPack_Post"true)
    
register_forward(FM_EmitSound"EmitSound"false)
    
g_iMaxPlayers get_maxplayers()
}

// int  )            (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
public AddToFullPack_Post(eseentidhostflagsplayer )
{
    static 
bitEffects
    
if(    player
    
&&    ent != id
    
&&    get_orig_retval()
    &&    (
bitEffects get_es(esES_Effects)) & EF_DIMLIGHT    )
    {
        
set_es(esES_EffectsbitEffects & ~EF_DIMLIGHT)
    }
}

//EmitSound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
// void )            (edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
public EmitSound(idchannel, const sample[])
{
    if( 
IsPlayer(id) && channel == CHAN_ITEM && equal(sample"items/flashlight1.wav") )
    {
        
client_cmd(id"spk items/flashlight1.wav")
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

Ehhe, because i don't know much about AddToFullPack forward. This forward is a bit tricky. By the way thanks for the full code.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
csoldjb
Member
Join Date: Dec 2010
Old 04-22-2012 , 09:55   Re: Render flashlight for only that player
Reply With Quote #6

I think you'd better use a module. Use AMXX plugins to hook AddToFullPack may use so much CPU.
csoldjb is offline
naSTR
Veteran Member
Join Date: Dec 2011
Location: Asia, Mongolia
Old 06-11-2012 , 10:48   Re: Render flashlight for only that player
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
You forgot to optimize it though.

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"
#define PLUGIN "Personal FlashLight"

new g_iMaxPlayers
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_forward(FM_AddToFullPack"AddToFullPack_Post"true)
    
register_forward(FM_EmitSound"EmitSound"false)
    
g_iMaxPlayers get_maxplayers()
}

// int  )            (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
public AddToFullPack_Post(eseentidhostflagsplayer )
{
    static 
bitEffects
    
if(    player
    
&&    ent != id
    
&&    get_orig_retval()
    &&    (
bitEffects get_es(esES_Effects)) & EF_DIMLIGHT    )
    {
        
set_es(esES_EffectsbitEffects & ~EF_DIMLIGHT)
    }
}

//EmitSound(id, CHAN_ITEM, "items/flashlight1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
// void )            (edict_t *entity, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch);
public EmitSound(idchannel, const sample[])
{
    if( 
IsPlayer(id) && channel == CHAN_ITEM && equal(sample"items/flashlight1.wav") )
    {
        
client_cmd(id"spk items/flashlight1.wav")
        return 
FMRES_SUPERCEDE
    
}
    return 
FMRES_IGNORED

Well still have aura from original flashlight
__________________
naSTR is offline
cOMpirm
Senior Member
Join Date: Jun 2012
Old 07-17-2012 , 03:03   Re: Render flashlight for only that player
Reply With Quote #8

yeah, not work too
cOMpirm is offline
Reply


Thread Tools
Display Modes

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


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