AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Default Flashlight: Only owner can see the light. (https://forums.alliedmods.net/showthread.php?t=147697)

yokomo 01-12-2011 14:01

[SOLVED] Default Flashlight: Only owner can see the light.
 
Hi did anyone know how to make only owner can see their flashlight. I don't want to use Custom Flashlight plugin. Original flashlight more efficient but i need only owner can see the light.

[IMG]http://img543.**************/img543/2624/dedust20001kr.png[/IMG]

ARES[ro] 01-12-2011 23:47

Re: [HELP] Default Flashlight: Only owner can see the light.
 
look at SgtBane`s predator mod its included inside.

ConnorMcLeod 01-13-2011 01:21

Re: [HELP] Default Flashlight: Only owner can see the light.
 
Hook AddToFullPack and remove flashlight from ES_Effects when ent is not host.
You can cache On/off status in a bit at FlashLight event.

yokomo 01-13-2011 07:52

Re: [HELP] Default Flashlight: Only owner can see the light.
 
Quote:

Originally Posted by ARES[ro] (Post 1392492)
look at SgtBane`s predator mod its included inside.

I've see predator mod flash light effect but it's flashing, i want default flashlight effect.

Quote:

Originally Posted by ConnorMcLeod (Post 1392505)
Hook AddToFullPack and remove flashlight from ES_Effects when ent is not host.
You can cache On/off status in a bit at FlashLight event.

OMG how to do this can you make an example.

ConnorMcLeod 01-13-2011 10:47

Re: [HELP] Default Flashlight: Only owner can see the light.
 
You can code or you want the full code ?
If you want the whole code your are not in the right forum.

meTaLiCroSS 01-13-2011 10:58

Re: [HELP] Default Flashlight: Only owner can see the light.
 
PHP Code:

if(ent != hostset_es(es_handleES_Effectsget_es(es_handleES_Effects) & ~EF_DIMLIGHT

That? D:

yokomo 01-13-2011 14:14

Re: [HELP] Default Flashlight: Only owner can see the light.
 
Quote:

Originally Posted by ConnorMcLeod (Post 1392726)
You can code or you want the full code ?
If you want the whole code your are not in the right forum.

My coding skills is very limited, if you are free can you give me the whole code. So i can study about it. Sorry if i am in the wrong section.

ARES[ro] 01-13-2011 22:40

Re: [HELP] Default Flashlight: Only owner can see the light.
 
The code metalicross added works right just put it in your FM_AddToFullPack forward.

yokomo 08-04-2011 08:50

Re: [HELP] Default Flashlight: Only owner can see the light.
 
Sorry revived my old thread. OK i have done with this code:
PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Ghost Flash Light"
#define VERSION "1.0.0"
#define AUTHOR "yokomo"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_AddToFullPack"fw_full_pack"1)
}

public 
fw_full_pack(eseenthosthostflagsplayerpSet)
{
    if(!
pev_valid(ent)) return FMRES_IGNORED
    
    
if(ent != hostset_es(esES_Effectsget_es(esES_Effects) & ~EF_DIMLIGHT)
    
    return 
FMRES_IGNORED


Tested and works fine but i don't know it will make server lag or not. If someone can optimize it i feel so appreciate.

ConnorMcLeod 08-04-2011 09:24

Re: [HELP] Default Flashlight: Only owner can see the light.
 
Main thing you forgot is to check if a player is passed, adding this filter would prevent many checks on every other entities than player.
Then, get_orig_retval check, if it is 0 it means the player is not viewable from host or is dead, so don't bother.
Last, check ES_Effects first so you make sure you need to set it or not.

PHP Code:

public fw_full_pack(eseenthosthostflagsplayerpSet)
{
    static 
bitEffects
    
if(    player
    
&&    host != ent
    
&&    get_orig_retval()
    &&    (
bitEffects get_es(esES_Effects)) & EF_DIMLIGHT    )
    {
        
set_es(esES_EffectsbitEffects & ~EF_DIMLIGHT)
    }




All times are GMT -4. The time now is 02:08.

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