Raised This Month: $207 Target: $400
 51% 

Glow instead of flashlight


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sanimare
Senior Member
Join Date: Sep 2010
Old 11-23-2019 , 15:26   Glow instead of flashlight
Reply With Quote #1

Hi,

My request is to set glow to player who presses F (+flashlight or impulse 101).
Glow can be in radius little or bigger so i can set it, in .sma, no need for cvar.
Blue glow for CT and Red for TT.
When you are in CT blue glow and only counters see it, in TT red glow and only terrorists see it.

Thank's
sanimare is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 05-01-2020 , 16:27   Re: Glow instead of flashlight
Reply With Quote #2

Update
sanimare is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-02-2020 , 14:30   Re: Glow instead of flashlight
Reply With Quote #3

Can we make the VIP green like Green Lantern?

Is that how you want it? Beyond just a model glow.
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty a beauty cold and austere, like that of sculpture..." -Bertrand Russell

Last edited by DJEarthQuake; 05-02-2020 at 16:09.
DJEarthQuake is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 05-03-2020 , 20:52   Re: Glow instead of flashlight
Reply With Quote #4

@DJEarthQuake

You are totally right.
Make it glow (CT in blue/TT in red) - little glow, i don't need something enormous.
sanimare is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-04-2020 , 14:22   Re: Glow instead of flashlight
Reply With Quote #5

For those who play assassination maps what color do think the VIP should be?
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty a beauty cold and austere, like that of sculpture..." -Bertrand Russell
DJEarthQuake is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-27-2020 , 13:02   Re: Glow instead of flashlight
Reply With Quote #6

You no longer need?
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty a beauty cold and austere, like that of sculpture..." -Bertrand Russell
DJEarthQuake is offline
ExodoX
Junior Member
Join Date: Oct 2011
Location: Argentina
Old 05-27-2020 , 23:01   Re: Glow instead of flashlight
Reply With Quote #7

im interested :9 for vip you can set a green color
ExodoX is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 05-28-2020 , 05:31   Re: Glow instead of flashlight
Reply With Quote #8

Updated so opposing team cannot see. Amxx 1.82
PHP Code:
/*
 * glow_flashlight.sma Toggle Flashlight and you glow depending on team.
 * 
 * Copyright 2020 SPiNX
 * 
 * This program 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; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * 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 program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 * 
 * 2020-12-02  1.0 to 1.1 SPiNX
 * Updated so opposing team cannot see.
 * 
*/

#include amxmodx
#include engine
#include fakemeta

#define MAX_IP_LENGTH     16
#define MAX_NAME_LENGTH   32
#define MAX_PLAYERS       32
#define MAX_AUTHID_LENGTH 64
//#define DEBUG

new bool:cool_down_active
new glowteam[MAX_IP_LENGTH], g_radiusg_timeoverhead_icon_ct,overhead_icon_t;
new 
playersMAX_PLAYERS ], team_nameMAX_NAME_LENGTH ], signalers_nameMAX_NAME_LENGTH ], playercount;
new 
Origin[3];


public 
plugin_init()

{
    
register_plugin("Team Glow flashlight""1.1""SPiNX");
    
register_impulse(100"client_impulse_flashlight");
    
g_radius register_cvar("glow_radius""20")
    
g_time register_cvar("glow_time""10")
    
register_logevent("round_start"2"1=Round_Start");
    
register_logevent("round_end"2"1=Round_End");
}

public 
client_impulse_flashlight(iPlayers_index)

    
glowinsteadofflashlight(iPlayers_index);


public 
round_start()

    
cool_down_active false


public round_end()

    
cool_down_active true


public plugin_precache()

{
    
overhead_icon_ct precache_model("models/in_teleport.mdl");
    
overhead_icon_t precache_model("models/out_teleport.mdl");
}

public 
glowinsteadofflashlight(iPlayers_index)

{
    
get_user_team(iPlayers_indexglowteamcharsmax(glowteam));

    if(
is_user_alive(iPlayers_index) && !cool_down_active)

        {
            
get_user_origin(iPlayers_indexOrigin);
            
get_players(players,playercount,"ae"glowteam)

            for (new 
m=0playercount; ++m)

            {

            
#if defined DEBUG
            
server_print("Team is %s"glowteam);
            
#endif

            
get_user_name(players[m], team_namecharsmax(team_name) );

            if(!
is_user_bot(players[m]))
                
get_user_name(iPlayers_indexsignalers_namecharsmax(signalers_name) );

            
#if defined DEBUG
            
client_print(iPlayers_indexprint_chat"Trying to send glow to %s",team_name);
            
#endif

            
client_print(players[m], print_center"%s is signaling",signalers_name);

            
emessage_beginMSG_ONE_UNRELIABLESVC_TEMPENTITY, { 00}, players[m] );
            
ewrite_byte(TE_PLAYERATTACHMENT)
            
ewrite_byte(iPlayers_index)
            
ewrite_coord(MAX_AUTHID_LENGTH//(attachment origin.z = player origin.z + vertical offset)
            
if(equal(glowteam"CT"))
                
ewrite_short(overhead_icon_ct)
            else
                
ewrite_short(overhead_icon_t)
            
ewrite_short(MAX_IP_LENGTH//life * 10
            
emessage_end();

            
emessage_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY,{0,0,0},players[m]);
            
ewrite_byte(TE_DLIGHT);

            
ewrite_coord(Origin[0]);
            
ewrite_coord(Origin[1]);
            
ewrite_coord(Origin[2]);

            
ewrite_byte(get_pcvar_num(g_radius)); ///(radius in 10's)

            //CS team RGB messaging
            
if(equal(glowteam"CT"))
                {
                    if (
entity_get_float(iPlayers_indexEV_FL_armorvalue) < 101.0)
                        {
                            
ewrite_byte(0);
                            
ewrite_byte(0);
                            
ewrite_byte(255);
                        }

                        else 
/* VIP */
                            
{
                                
ewrite_byte(0);
                                
ewrite_byte(255);
                                
ewrite_byte(0);
                            }

                }

            if(
equal(glowteam"TERRORIST"))

                {
                    
ewrite_byte(255);
                    
ewrite_byte(0);
                    
ewrite_byte(0);
                }

            
ewrite_byte(get_pcvar_num(g_time));  ///life
            
ewrite_byte(get_pcvar_num(g_time));  ///(decay rate in 10's)
            
emessage_end();

            
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY,{0,0,0},players[m]);
            
ewrite_byte(TE_ELIGHT);

            
ewrite_short(iPlayers_index);

            
ewrite_coord(Origin[0]);
            
ewrite_coord(Origin[1]);
            
ewrite_coord(Origin[2]);

            
ewrite_coord(get_pcvar_num(g_radius));  ///(radius in 10's)

            //CS team RGB messaging
            
if(equal(glowteam"CT"))
                {
                    if (
entity_get_float(iPlayers_indexEV_FL_armorvalue) < 101.0)
                        {
                            
ewrite_byte(0);
                            
ewrite_byte(0);
                            
ewrite_byte(255);
                        }

                        else 
/* VIP */
                            
{
                                
ewrite_byte(0);
                                
ewrite_byte(255);
                                
ewrite_byte(0);
                            }

                    }

            if(
equal(glowteam"TERRORIST"))

                {
                    
ewrite_byte(255);
                    
ewrite_byte(0);
                    
ewrite_byte(0);
                }

            
ewrite_byte(get_pcvar_num(g_time));   ///life
            
ewrite_coord(get_pcvar_num(g_time));  ///(decay rate in 10's)
            
emessage_end();
        }
    }

Original. Everybody can see. Requires Amxx 1.9.0
Spoiler
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty a beauty cold and austere, like that of sculpture..." -Bertrand Russell

Last edited by DJEarthQuake; 12-21-2020 at 07:49. Reason: Update: Show playername. Opposing team cannot see. Red or Blue overhead icons. Adjust get_players per bot testing.
DJEarthQuake is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 06-05-2020 , 09:05   Re: Glow instead of flashlight
Reply With Quote #9

Working perfect!

Can you just make it when you press F to show up glow for like 2 seconds and auto-disappear (cvar would be good or in sma) and showing glow only for team, you don't see enemy glow (cvar too or in sma) ?

Implementing "show name" would be great too.
I have some edited code that's working when you aim at player, can you implement with this plugin to show hud name too when he press F (cvar or in sma settings)?

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

new gCvarEnable;
new 
gCvarAlpha;
new 
gCvarShowNames;
new 
gMaxPlayers;
new 
gHudSyncObj;
new 
gPlayerTeam[33];

new 
bool:gPlayerSolid[33];
new 
bool:gPlayerRestore[33];

public 
plugin_init() 
{
    
register_plugin("HNS_SEMICLIP""1.0""Jon");
        
    
gCvarEnable register_cvar("hns_teamsemiclip""1");
    
gCvarAlpha register_cvar("hns_teamsemiclip_alpha""200")
    
gCvarShowNames register_cvar("hns_teamsemiclip_shownames""1")
    
gMaxPlayers get_maxplayers();
    
    
register_forward(FM_AddToFullPack"fwd_AddToFullPack"1);
    
register_forward(FM_PlayerPreThink"fwd_PlayerPreThink"0);
    
register_forward(FM_PlayerPostThink"fwd_PlayerPostThink"0);
}

public 
plugin_precache()
    
gHudSyncObj CreateHudSyncObj();

public 
fwd_AddToFullPack(eseenthosthostflagsplayerpSet)
{
    if(
get_pcvar_num(gCvarEnable))
    {
        if(
player)
        {
            if(
gPlayerSolid[host] && gPlayerSolid[ent] && gPlayerTeam[host] == gPlayerTeam[ent])
            {
                
set_es(esES_SolidSOLID_NOT);
                
set_es(esES_RenderModekRenderTransAlpha);
                
set_es(esES_RenderAmtget_pcvar_num(gCvarAlpha));
            }
        }
    }
}

FirstThink()
{
    for(new 
1<= gMaxPlayersi++)
    {
        if(!
is_user_alive(i))
        {
            
gPlayerSolid[i] = false;
            continue;
        }
        
        
gPlayerTeam[i] = get_user_team(i);
        
gPlayerSolid[i] = pev(ipev_solid) == SOLID_SLIDEBOX true false;
    }
}

public 
fwd_PlayerPreThink(id)
{
    if(
get_pcvar_num(gCvarEnable))
    {
        if(
get_pcvar_num(gCvarShowNames) && is_user_alive(id))
        {
            new 
Target
            
new Temp
        
            get_user_aiming
(idTargetTemp9999)
            
            if(
Target && get_user_team(id) == get_user_team(Target))
            {
                new 
TargetName[32]
                
get_user_name(TargetTargetName31)
                
                switch(
get_user_team(id))
                {
                    case 
1set_hudmessage(25500, -1.00.4000.00.10.00.02);
                    case 
2set_hudmessage(00255, -1.00.4000.00.10.00.02);
                }
                
                
ShowSyncHudMsg(idgHudSyncObj"%s"TargetName)
            }
        }
        
        static 
iLastThink;
        
        if(
LastThink id)
        {
            
FirstThink();
        }
    }
}

public 
fwd_PlayerPostThink(id)
{
    if(
get_pcvar_num(gCvarEnable))
    {
        static 
i;
        
        for(
1<= gMaxPlayersi++)
        {
            if(
gPlayerRestore[i])
            {
                
set_pev(ipev_solidSOLID_SLIDEBOX);
                
gPlayerRestore[i] = false;
            }
        }
    }

Thank's
sanimare is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 06-05-2020 , 12:05   Re: Glow instead of flashlight
Reply With Quote #10

Glad it does the trick.

Added the HUD playername style.
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty a beauty cold and austere, like that of sculpture..." -Bertrand Russell

Last edited by DJEarthQuake; 12-02-2020 at 11:14.
DJEarthQuake 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 13:24.


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