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

c4 hud fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-16-2007 , 13:06   c4 hud fix
Reply With Quote #1

hi, i maked this:
Code:
#include <amxmodx>
#include <amxmisc>
#include <csx>

new g_c4timer;
new mp_timec4;
new bool:b_planted = false;


public plugin_init()
{
    register_plugin("Test","0.1","SAMURAI");
    mp_timec4 = get_cvar_num("mp_c4timer")
    
    register_event("RoundTime", "newRound", "bc")
    register_event("SendAudio", "endRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
}


public newRound()
{
    g_c4timer = 0
    b_planted = false;
}

public endRound()
{
    g_c4timer = -2
}

public bomb_planted()
{
    b_planted = true;
    g_c4timer = mp_timec4 
    set_task(1.0, "dispTime", 652450, "", 0, "b")
}

public dispTime()
{
    
    if(!b_planted)
    remove_task(652450)
    
    
    if(g_c4timer < 8) set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)

    if(g_c4timer > 7) set_hudmessage(150, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)

    if(g_c4timer > 13) set_hudmessage(0, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)
        
    show_hudmessage(0, "C4: %d",max(--g_c4timer,0))
    
}
But doesen't works correctly
So, for example "mp_c4timer is 35", appear with hudmessage only C4 : 34 ;
Any ideia to fix this ? thanks
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 02-16-2007 , 13:20   Re: c4 hud fix
Reply With Quote #2

I'd reckon it's because you have --g_c4timer which subtracts 1 from g_c4timer.
__________________
Brad is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-16-2007 , 13:21   Re: c4 hud fix
Reply With Quote #3

should be
Code:
show_hudmessage(0, "C4: %d",g_c4timer)
?
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 02-16-2007 , 13:33   Re: c4 hud fix
Reply With Quote #4

I think:
Code:
show_hudmessage(0, "C4: %d", g_c4timer)
g_c4timer--
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 02-16-2007 , 13:36   Re: c4 hud fix
Reply With Quote #5

Quote:
Originally Posted by SAMURAI16 View Post
should be
Code:
show_hudmessage(0, "C4: %d",g_c4timer)
?
I don't know. You tell me. I really don't know what you're trying to do. I thought I did but then you were subtracting 1 from the variable at which point I gave up trying to understand.
__________________
Brad is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-16-2007 , 13:41   Re: c4 hud fix
Reply With Quote #6

with this works,
Code:
#include <amxmodx>
#include <amxmisc>
#include <csx>

new g_c4timer;
new mp_timec4;
new bool:b_planted = false;


public plugin_init()
{
    register_plugin("Test","0.1","SAMURAI");
    mp_timec4 = get_cvar_num("mp_c4timer")
    
    register_event("RoundTime", "newRound", "bc")
    register_event("SendAudio", "endRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
}


public newRound()
{
    g_c4timer = 0
    b_planted = false;
}

public endRound()
{
    g_c4timer = -2
}

public bomb_planted()
{
    b_planted = true;
    g_c4timer = mp_timec4 
    set_task(1.0, "dispTime", 652450, "", 0, "b")
}

public bomb_explode()
{
    if(b_planted)
    remove_task(652450)
    
    return PLUGIN_CONTINUE;
}
    

public dispTime()
{
    
    if(!b_planted)
    remove_task(652450)
    
    
    if(g_c4timer < 8) set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)

    if(g_c4timer > 7) set_hudmessage(150, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)

    if(g_c4timer > 13) set_hudmessage(0, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)
        
    
    show_hudmessage(0, "C4: %d",g_c4timer)
    g_c4timer--
    
}
- I added bomb_explode forward to stop c4 timer because it's appear after 0, -1,-2,-3 etc ;P
- But, it's changed completely the c4 timer cvar ; It's changed it in "45 seconds" . Why ?
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 02-16-2007 , 14:08   Re: c4 hud fix
Reply With Quote #7

EDIT: I think this will work.
Code:
#include <amxmodx> #include <csx> new g_c4timer; public plugin_init() {     register_plugin("Test", "0.1", "SAMURAI");         register_event("RoundTime", "newRound", "bc")     register_event("SendAudio", "endRound", "a", "1=0") } public bomb_planted() {     g_c4timer = get_cvar_num("mp_c4timer");     set_task(1.0, "dispTime", 652450, "", 0, "a", g_c4timer) } public bomb_explode()     remove_task(652450) public bomb_defused()     remove_task(652450) public dispTime() {     g_c4timer--     show_hudmsg() } show_hudmsg() {     switch ( g_c4timer ) {         case 0..7 : set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)                     case 8..13 : set_hudmessage(150, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)                     default : set_hudmessage(0, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)     }     show_hudmessage(0, "C4: %d", g_c4timer) }

Last edited by [ --<-@ ] Black Rose; 02-16-2007 at 14:18.
[ --<-@ ] Black Rose is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-24-2007 , 09:37   Re: c4 hud fix
Reply With Quote #8

i remaked with pcvars, and doesent works
CODE:
Code:
#include <amxmodx>
#include <amxmisc>
#include <csx>

new g_c4timer;
new mp_timec4;
new bool:b_planted = false;
new pointnum

new const PLUGIN[] = "Bomb CountHUD Timer"
new const VERSION[] = "0.1"
new const AUTHOR[] = "SAMURAI"

public plugin_init()
{
    register_plugin(PLUGIN,VERSION,AUTHOR);
   
    pointnum = get_cvar_pointer("mp_c4timer");
    
    register_event("RoundTime", "newRound", "bc");
    register_event("SendAudio", "endRound", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw");
    
    
    mp_timec4 = get_pcvar_num(pointnum);
}


public newRound()
{
    mp_timec4 = get_pcvar_num(pointnum);
    
    g_c4timer = 0
    b_planted = false;
}

public endRound()
{
    mp_timec4 = get_pcvar_num(pointnum);
    
    g_c4timer = -2
}

public bomb_planted()
{
    mp_timec4 = get_pcvar_num(pointnum)
    
    b_planted = true;
    g_c4timer = mp_timec4 
    set_task(1.0, "dispTime", 652450, "", 0, "b")
}

public bomb_defused()
{
    mp_timec4 = get_pcvar_num(pointnum)
    
    if(b_planted)
    remove_task(652450);
}

public bomb_explode()
{
    mp_timec4 = get_pcvar_num(pointnum)

    if(b_planted)
    remove_task(652450)
    
}
   
   
public dispTime()
{
    mp_timec4 = get_pcvar_num(pointnum)
    
    if(!b_planted)
    remove_task(652450)
    
    if(g_c4timer < 8) set_hudmessage(150, 0, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)

    if(g_c4timer > 7) set_hudmessage(150, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)

    if(g_c4timer > 13) set_hudmessage(0, 150, 0, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1)
        
    
    show_hudmessage(0, "C4: %d",g_c4timer)
    g_c4timer--
    
}
It's changed the mp_c4timer timer cvar, and i don't understand why
Have anybody an idea to fix it ?
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
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 11:19.


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