Raised This Month: $ Target: $400
 0% 

Color changes on c4 timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
impossible89
Member
Join Date: Jun 2020
Old 12-26-2023 , 12:10   Color changes on c4 timer
Reply With Quote #1

Hi would the timer be able to be changed like the miscstats base plugin

by betting the bomb to be green and then change to yellow and red

I also want the Boom, Defuse, End labels to be different colors
Boom - in red color
Defuse - in green color
END - in blue
And add coordinates for the message if it needs to be moved to another position
Attached Files
File Type: sma Get Plugin or Get Source (c4timer.sma - 66 views - 2.2 KB)
impossible89 is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 12-26-2023 , 16:51   Re: Color changes on c4 timer
Reply With Quote #2

[QUOTE=impossible89;2814972]Hi would the timer be able to be changed like the miscstats base plugin




Did you test this plugin?
I think before you post any request, you should test whether it actually works.
Uzviseni Bog is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 12-26-2023 , 20:33   Re: Color changes on c4 timer
Reply With Quote #3

coordinate cvar already exists
cvars; C4ColorEnd C4ColorDefuse C4ColorBoom C4_Position
give it a shot
PHP Code:
#include <amxmodx>
#include <reapi>

new g_iTimerEnt
new g_pC4Timerg_iTimerg_pCvarColorg_pCvarColor2g_pCvarColor3g_pCvarPosition
new szColors[17], szRed[4], szGreen[4], szBlue[4], szPosition[33], szX[17], szY[17]

public 
plugin_init()
{
    
register_plugin("C4Timer""1.0""mi0")

    
RegisterHookChain(RG_PlantBomb"RG_PlantBomb_Hook")
    
RegisterHookChain(RG_RoundEnd"RG_RoundEnd_Hook")
    
RegisterHookChain(RG_CGrenade_DefuseBombEnd"RG_CGrenade_DefuseBombEnd_Hook")

    
g_iTimerEnt rg_create_entity("info_target")
    
set_entvar(g_iTimerEntvar_classname"Task_Ent")
    
g_pC4Timer get_cvar_pointer("mp_c4timer")
    
g_pCvarColor register_cvar("C4ColorEnd""255 0 0")
    
g_pCvarColor2 register_cvar("C4ColorDefuse""255 0 0")
    
g_pCvarColor3 register_cvar("C4ColorBoom""255 0 0")
    
g_pCvarPosition register_cvar("C4_Position""0.40 0.95")

    
SetThink(g_iTimerEnt"Entity_Think")
}

public 
RG_PlantBomb_Hook(id)
{
    
g_iTimer get_pcvar_num(g_pC4Timer)

    
get_pcvar_string(g_pCvarColorszColors16)
    
get_pcvar_string(g_pCvarPositionszPosition32)

    
parse(szColorsszRed3szGreen3szBlue3)
    
parse(szPositionszX16szY16)

    
set_dhudmessage(str_to_num(szRed), str_to_num(szGreen), str_to_num(szBlue), str_to_float(szX), str_to_float(szY), __1.0)
    
show_dhudmessage(0"C4Timer: %i"g_iTimer)

    
set_entvar(g_iTimerEntvar_nextthink1.0 get_gametime())
}

public 
Entity_Think(iEntID)
{
    if(
iEntID == g_iTimerEnt)
    {
        
get_pcvar_string(g_pCvarPositionszPosition32)
        
parse(szPositionszX16szY16)

        switch (
g_iTimer)
        {
            case -
1:
            {
                
get_pcvar_string(g_pCvarColorszColors16)
                
parse(szColorsszRed3szGreen3szBlue3)
                
set_dhudmessage(str_to_num(szRed), str_to_num(szGreen), str_to_num(szBlue), str_to_float(szX), str_to_float(szY), __1.0)
                
show_dhudmessage(0"[C4] Timer: END")
            }

            case -
2:
            {
                
get_pcvar_string(g_pCvarColor2szColors16)
                
parse(szColorsszRed3szGreen3szBlue3)
                
set_dhudmessage(str_to_num(szRed), str_to_num(szGreen), str_to_num(szBlue), str_to_float(szX), str_to_float(szY), __1.0)
                
show_dhudmessage(0"[C4] Timer: DEFUSE")
            }

            case 
1:
            {
                
get_pcvar_string(g_pCvarColor3szColors16)
                
parse(szColorsszRed3szGreen3szBlue3)
                
set_dhudmessage(str_to_num(szRed), str_to_num(szGreen), str_to_num(szBlue), str_to_float(szX), str_to_float(szY), __1.0)
                
show_dhudmessage(0"[C4] Timer: BOOM")
            }

            default:
            {
                
get_pcvar_string(g_pCvarColorszColors16)
                
parse(szColorsszRed3szGreen3szBlue3)
                
set_dhudmessage(str_to_num(szRed), str_to_num(szGreen), str_to_num(szBlue), str_to_float(szX), str_to_float(szY), __1.0)
                
show_dhudmessage(0"[C4] Timer: %i", --g_iTimer)
                
set_entvar(g_iTimerEntvar_nextthink1.0 get_gametime())
            }
        }
        
get_pcvar_string(g_pCvarColorszColors16)
    }
}

public 
RG_RoundEnd_Hook()
    
g_iTimer g_iTimer == -? -: -1

public RG_CGrenade_DefuseBombEnd_Hook(thisplayerbool:bDefused)
    if(
bDefusedg_iTimer g_iTimer == -? -: -
__________________
bigdaddy424 is offline
impossible89
Member
Join Date: Jun 2020
Old 12-27-2023 , 17:34   Re: Color changes on c4 timer
Reply With Quote #4

This has nothing to do with what I want, it's a bug

I want the timer seconds until the bomb goes off to be a different color

35-20 seconds to be in green color
19-10 in yellow color
10-0 to be in red color


and the inscriptions below BOOM, DEDUSE, END to be in a different color to have an option for coordinates as well as an option for how many seconds to hold the inscription and an option for a normal inscription, flicker, typewriter
impossible89 is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 12-27-2023 , 19:34   Re: Color changes on c4 timer
Reply With Quote #5

good luck buddy!
__________________
bigdaddy424 is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 12-27-2023 , 19:38   Re: Color changes on c4 timer
Reply With Quote #6

Quote:
Originally Posted by bigdaddy424 View Post
good luck buddy!
If you don't want to help, I don't know why you even leave feedback.
Uzviseni Bog is offline
Uzviseni Bog
Senior Member
Join Date: Jun 2020
Old 12-27-2023 , 19:39   Re: Color changes on c4 timer
Reply With Quote #7

Quote:
Originally Posted by impossible89 View Post
This has nothing to do with what I want, it's a bug
I want the timer seconds until the bomb goes off to be a different color
35-20 seconds to be in green color
19-10 in yellow color
10-0 to be in red color
and the inscriptions below BOOM, DEDUSE, END to be in a different color to have an option for coordinates as well as an option for how many seconds to hold the inscription and an option for a normal inscription, flicker, typewriter



Try this, I hope this is what you had in mind?
c4timer.amxx
c4timer.sma

Last edited by Uzviseni Bog; 12-27-2023 at 19:40.
Uzviseni Bog is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 12-27-2023 , 20:59   Re: Color changes on c4 timer
Reply With Quote #8

Quote:
Originally Posted by Uzviseni Bog View Post
If you don't want to help, I don't know why you even leave feedback.
you dont understand
if you seek help your job is to provide as much information as possible and not let other guess what you have in mind
__________________
bigdaddy424 is offline
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 21:52.


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