Raised This Month: $ Target: $400
 0% 

default cs flashlight fix


Post New Thread Reply   
 
Thread Tools Display Modes
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 05-16-2011 , 12:20   Re: default cs flashlight fix
Reply With Quote #11

Quote:
Originally Posted by jc980 View Post
yeah, when i disable custom flashlight it goes back to 30 fps. lol.
Why cs lights lag but css lights not lag ?
.Dare Devil. is offline
jc980
Veteran Member
Join Date: Jan 2010
Location: God is with us...
Old 05-16-2011 , 12:58   Re: default cs flashlight fix
Reply With Quote #12

Quote:
Originally Posted by .Dare Devil. View Post
Why cs lights lag but css lights not lag ?
yeah, when i disabled ZP plugin my fps goes back to 60 fps. so strange. does mods and simple plugins eats up cpu and fps? depending on their size? ( lines )
__________________
jc980 is offline
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 05-17-2011 , 03:21   Re: default cs flashlight fix
Reply With Quote #13

That's definetely not depending on the plugin size. Just coding skills. A code with more than 1000 lines could use less cpu than a code with just 5 lines. I figured out that by myself several times ;) xD
__________________
  • ZapTic - Paintball (Version 7.1.3 b1303)
  • Your #1 CS Paintball Server since 2008
  • 85.131.163.101:27015
Leon M. is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-21-2011 , 10:25   Re: default cs flashlight fix
Reply With Quote #14

Try this :

PHP Code:
/*    Formatright © 2010, ConnorMcLeod

    This plugin is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this plugin; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>

#define VERSION "0.0.1"
#define PLUGIN "FlashLight Fix"

#define MAX_PLAYERS        32

new g_bitPlayerFlashlight
#define MarkPlayerFlashLight(%0)    g_bitPlayerFlashlight |= 1<<(%0&31)
#define ClearPlayerFlashLight(%0)    g_bitPlayerFlashlight &= ~(1<<(%0&31))
#define HasPlayerFlashLightOn(%0)    ( g_bitPlayerFlashlight & 1<<(%0&31) )

new g_iPlayerTarget[MAX_PLAYERS+1] = {FM_NULLENTFM_NULLENT, ...}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_forward(FM_AddToFullPack"AddToFullPack_Post"1)
    
register_forward(FM_PlayerPreThink"PlayerPreThink")
    
register_event("Flashlight""Event_Flashlight""b")
}

public 
Event_Flashlightid )
{
    if( 
read_data(1) )
    {
        
MarkPlayerFlashLight(id)
    }
    else
    {
        
ClearPlayerFlashLight(id)
    }
}

public 
PlayerPreThink(id)
{
    if( 
HasPlayerFlashLightOn(id) )
    {
        static 
dummy
        get_user_aiming
(idg_iPlayerTarget[id], dummy)
    }
    else
    {
        
g_iPlayerTarget[id] = FM_NULLENT
    
}
}

// int AddToFullPack( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet )
public AddToFullPack_Post(eseiEntidhostflagsplayer)
{
    if( !
player || iEnt == id || !get_orig_retval() || !is_user_alive(id) || !is_user_alive(iEnt) )
    {
        return
    }

    if( 
g_iPlayerTarget[id] == iEnt )
    {
        if( !
HasPlayerFlashLightOn(iEnt) )
        {
            
set_es(esES_Effectsget_es(esES_Effects) | EF_DIMLIGHT)
        }
    }
    else if( 
HasPlayerFlashLightOn(iEnt) )
    {
        
set_es(esES_Effectsget_es(esES_Effects) & ~EF_DIMLIGHT)
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 05-21-2011 , 17:55   Re: default cs flashlight fix
Reply With Quote #15

thank you connor
can you make it look the same as the default flashlight?
and remove the light when aiming on a player?
here's a video so you can understand better what i mean: http://www.youtube.com/user/georgik5.../0/WNfsKqMu6C0
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 06-07-2011 , 10:53   Re: default cs flashlight fix
Reply With Quote #16

bump
help please
take a look at the video
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 06-08-2011 , 03:33   Re: default cs flashlight fix
Reply With Quote #17

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

new bs_Flashlight
#define add_bitsum(%1,%2) (%1 |= (1<<(%2-1)))
#define del_bitsum(%1,%2) (%1 &= ~(1<<(%2-1)))
#define get_bitsum(%1,%2) (%1 & (1<<(%2-1)))

public plugin_init()
{
    
register_plugin("no EF_DIMLIGHT""1.0""schmurgel1983")
    
    
register_forward(FM_AddToFullPack"fwd_AddToFullPack_Post"1)
    
    
register_message(get_user_msgid("Flashlight"), "message_flashlight")
}


public 
fwd_AddToFullPack_Post(es_handleeenthostflagsplayerpSet)
{
    if (!
player || host == ent || !get_bitsum(bs_Flashlightent))
        return 
FMRES_IGNORED;
    
    
set_es(es_handleES_Effectsget_es(es_handleES_Effects) & ~EF_DIMLIGHT
    
    return 
FMRES_IGNORED;
}

public 
message_flashlight(msg_idmsg_destmsg_entity)
{
    
get_msg_arg_int(1) ? add_bitsum(bs_Flashlightmsg_entity) : del_bitsum(bs_Flashlightmsg_entity);

__________________

Working on:
nothing
schmurgel1983 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-08-2011 , 11:38   Re: default cs flashlight fix
Reply With Quote #18

I already do this in the plugin i gave him, but when you aim at a player with your FL on that player light doesn't change, that's why in that case i add the DIMLIGHT effect.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 06-08-2011 , 11:57   Re: default cs flashlight fix
Reply With Quote #19

okay everything solved
schmurgel helped me make it look closer to the default flashlight
please tell if you find any mistakes ^^
PHP Code:
#include <amxmodx>
#include <fakemeta>

new g_bitPlayerFlashlightg_iMaxPlayers

#define MarkPlayerFlashLight(%0)    g_bitPlayerFlashlight |= 1<<(%0&31)
#define ClearPlayerFlashLight(%0)    g_bitPlayerFlashlight &= ~(1<<(%0&31))
#define HasPlayerFlashLightOn(%0)    (g_bitPlayerFlashlight & 1<<(%0&31))

public plugin_init()
{
    
register_plugin("[ZPNM] Default FlashLight Fix""0.0.2""ConnorMcLeod, schmurgel1983")
    
    
register_forward(FM_PlayerPreThink"PlayerPreThink")
    
    
register_event("Flashlight""Event_Flashlight""b")
    
    
g_iMaxPlayers get_maxplayers()
}

public 
Event_Flashlight(id)
{
    if (
read_data(1))
        
MarkPlayerFlashLight(id)
    else
        
ClearPlayerFlashLight(id)
}

public 
PlayerPreThink(id)
{
    static 
aimdummy
    aim 
0
    get_user_aiming
(idaimdummy)
    
    if (!
HasPlayerFlashLightOn(id)
    || 
aim || aim g_iMaxPlayers
    
|| HasPlayerFlashLightOn(aim))
        return;
    
    static 
origin[3]; get_user_origin(idorigin3)
    
    
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_id)
    
write_byte(TE_DLIGHT// TE id
    
write_coord(origin[0]) // x
    
write_coord(origin[1]) // y
    
write_coord(origin[2]) // z
    
write_byte(random_num(911)) // radius
    
write_byte(57// r
    
write_byte(57// g
    
write_byte(57// b
    
write_byte(1// life
    
write_byte(0// decay rate
    
message_end()

__________________

Last edited by georgik57; 06-08-2011 at 12:02.
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
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 16:57.


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