PDA

View Full Version : Cerere plugin timp bomba [REZOLVAT]



ElShaarawy
24-04-2015, 11:00 PM
Vreau si eu pluginul acela cu timerul la bmb sa apara mesajul : Galati.WarGods.Ro secunde si sa-si schimbe culoarea pe secunda! Am vazut pe un server din indungi ! Si textul sa apara jos pe mijloc!
ex. Galati.WarGods.Ro 30
Galati.WarGods.Ro 29
Galati.WarGods.Ro 28

Tiger
25-04-2015, 12:22 PM
Netestat. Culori random la fiecare secunda.


/*
Bomb Countdown HUD Timer without CSX Version
v0.2 by SAMURAI


* Plugin Details
With this plugin enabled, you can see an colored Hud Message with the c4 time left, until explode
Remeber : if until explode remains less than 8 seconds, hudmessage color will be red, if > 7 will be yellow and > 13 will be green.


* Credits:
- Emp` for various indicates
- Alka for full tests


* Changelog
- Fixed Events problems
- Pcvars
- Fixed any bug on plugin

*/


#include <amxmodx>

#define PLUGIN "Bomb Countdown HUD Timer"
#define VERSION "0.2"
#define AUTHOR "SAMURAI"

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

new g_msgsync;

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR);

pointnum = get_cvar_pointer("mp_c4timer");

register_logevent("bomb_planted" , 3 , "2=Planted_The_Bomb");
register_logevent("bomb_defused" , 3 , "2=Defused_The_Bomb");
register_logevent("bomb_explode" , 6 , "3=Target_Bombed");

register_logevent("newRound", 2, "1=Round_Start");
register_logevent("endRound", 2, "1=Round_End");
register_logevent("endRound", 2, "1&Restart_Round_");

g_msgsync = CreateHudSyncObj();
}

public newRound()
{
g_c4timer = -1;
remove_task(652450);
b_planted = false;
}

public endRound()
{
g_c4timer = -1;
remove_task(652450);
}

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

public bomb_defused()
{
if(b_planted)
{
remove_task(652450);
b_planted = false;
}

}

public bomb_explode()
{
if(b_planted)
{
remove_task(652450);
b_planted = false;
}

}

public dispTime()
{
if(!b_planted)
{
remove_task(652450);
return;
}


if(g_c4timer >= 0)
{
static red, green, blue;

red = random_num(0, 255);
green = random_num(0, 255);
blue = random_num(0, 255);

set_hudmessage(red, green, blue, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);

ShowSyncHudMsg(0, g_msgsync, "Galati.WarGods.ro [C4: %d]", g_c4timer);

--g_c4timer;
}

}

Varianta functionala este cea de la post #4 (<b>You have to register to ba able to see this link</b>).

ElShaarawy
26-04-2015, 07:58 PM
Pluginul are o problema..numara din 2 in 2.. o rezolvati va rog?

Tiger
26-04-2015, 11:06 PM
Cel de sus nu l-am testat, dar urmatorul l-am reparat si testat:

/*
Bomb Countdown HUD Timer without CSX Version
v0.21 by SAMURAI


* Plugin Details
With this plugin enabled, you can see an colored Hud Message with the c4 time left, until explode
Remeber : if until explode remains less than 8 seconds, hudmessage color will be red, if > 7 will be yellow and > 13 will be green.


* Credits:
- Emp` for various indicates
- Alka for full tests


* Changelog
- Fixed Events problems
- Pcvars
- Fixed any bug on plugin

*/


#include <amxmodx>

#define PLUGIN "Bomb Countdown HUD Timer"
#define VERSION "0.21"
#define AUTHOR "SAMURAI"

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

new g_msgsync;

public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR);

pointnum = get_cvar_pointer("mp_c4timer");

register_logevent("bomb_planted" , 3 , "2=Planted_The_Bomb");
register_logevent("bomb_defused" , 3 , "2=Defused_The_Bomb");
register_logevent("bomb_explode" , 6 , "3=Target_Bombed");

register_logevent("newRound", 2, "1=Round_Start");
register_logevent("endRound", 2, "1=Round_End");
register_logevent("endRound", 2, "1&Restart_Round_");

g_msgsync = CreateHudSyncObj();
}

public newRound()
{
g_c4timer = -1;
remove_task(652450);
b_planted = false;
}

public endRound()
{
g_c4timer = -1;
remove_task(652450);
}

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

public bomb_defused()
{
if(b_planted)
{
remove_task(652450);
b_planted = false;
}

}

public bomb_explode()
{
if(b_planted)
{
remove_task(652450);
b_planted = false;
}

}

public dispTime()
{
if(!b_planted)
{
remove_task(652450);
return;
}


if(g_c4timer >= 0)
{
static red, green, blue;

red = random_num(0, 255);
green = random_num(0, 255);
blue = random_num(0, 255);

set_hudmessage(red, green, blue, -1.0, 0.80, 0, 1.0, 1.0, 0.01, 0.01, -1);

ShowSyncHudMsg(0, g_msgsync, "Galati.WarGods.ro [C4: %d]", g_c4timer);

--g_c4timer;
}

}

ElShaarawy
28-04-2015, 09:39 AM
Multumesc :D