HUD Countdown
Hey, i made a vipmenu plugin for my server, and i have a question.
On the menu, there is a "Noclip for 10 seconds [CT]" option.
How can i make it count down? Preferably via HUD.
If you need, here is everything that has anything to do with the noclip option.
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <colorchat>
new bool:NoclipUsed[33];
new const prefix[] = "^4[.Mp3 VIP] ~ ^3"
new szName[33], szPlayerName[33]
public plugin_init()
{
register_plugin("Jailbreak VIP", "0.9", "Ex1ne")
register_clcmd("say /vipmenu", "CmdVipMenu")
register_clcmd("say /vm", "CmdVipMenu")
register_clcmd("say_team /vipmenu", "CmdVipMenu")
register_clcmd("say_team /vm", "CmdVipMenu")
RegisterHam(Ham_Spawn, "player", "fw_spawn_player", 1)
}
public CmdVipMenu(id)
{
if(!(get_user_flags(id) & ADMIN_LEVEL_H))
{
ColorChat(id, GREY, "%s Only^4 VIPs^3 can open this menu.", prefix)
return PLUGIN_HANDLED
}
if(!is_user_alive(id)) //Thank's Larcyn <3
{
ColorChat(id, GREY, "%s You need to be alive to open this menu.", prefix)
return PLUGIN_HANDLED
}
new szText[555 char]
formatex(szText, charsmax(szText), "\y.Mp3 JB VIP Menu!")
new VipMenu = menu_create(szText, "VipMenuHandle")
formatex(szText, charsmax(szText), "\rGive yourself Noclip for 10 seconds! \y[CT]")
menu_additem(VipMenu, szText, "4", 0)
***menu handle blabla***
case 4: HandleNoclip(id)
***HANDLE***
public HandleNoclip(id)
{
if(!is_user_alive(id))
{
ColorChat(id, GREY, "%s You need to be alive to use this!", prefix)
return PLUGIN_HANDLED
}
if (get_user_team(id) != 2)
{
ColorChat(id, GREY, "%s Only Counter-Terrorists can use noclip!", prefix)
return PLUGIN_HANDLED
}
if(NoclipUsed[id] == true)
{
ColorChat(id, GREY, "%s You have allready used your Noclip!", prefix)
return PLUGIN_HANDLED
}
set_task(10.0, "RemoveNoclip", id)
ColorChat(0, GREY, "%s ^4%s^3 Now has noclip for 10 seconds!", prefix, szName)
set_user_noclip(id, 1)
NoclipUsed[id] = true
return PLUGIN_CONTINUE
}
public RemoveNoclip(id)
{
set_user_noclip(id, 0)
ColorChat(id, GREY, "%s You no longer have noclip.", prefix)
}
|