You should now understand how to do things with this example :
Code:
#include <amxmodx>
#include <fun>
#define MAX_PLAYERS 32
new g_timer
new bool: has_invis[MAX_PLAYERS + 1]
new bool: has_godmode[MAX_PLAYERS + 1]
//
//
//
//
public client_disconnected(id)
{
has_godmode[id] = false
has_invis[id] = false
}
case 0: // godmode
{
set_user_godmode(id , 1 )
has_godmode[id] = true
set_task(5.0 , "reset_godmode",id)
pre_show_timer(id)
}
case 1: // invisiblity
{
set_user_rendering(id, kRenderFxGlowShell, 0,0,0, kRenderTransAlpha, 0)
has_invis[id] = true
set_task(5.0 , "reset_invis" ,id)
pre_show_timer(id)
}
//
//
//
pre_show_timer(id)
{
g_timer = 5
show_timer(id)
set_task(1.0 , "show_timer" , id , _,_,"a",4)
}
public show_timer(id)
{
if (is_user_connected(id))
{
set_hudmessage(0 , 255 , 0 , -1.0 , 0.25 , 0, 8.0,1.0, 0.1, 0.1, 1)
show_hudmessage(id , "%d" , g_timer)
--g_timer
}
}
//
//
public reset_godmode(id)
{
if (has_godmode[id])
{
set_user_godmode(id , 0)
}
has_godmode[id] = false
}
//
//
public reset_invis(id)
{
if (has_invis[id])
{
set_user_rendering(id, kRenderFxGlowShell, 0,0,0, kRenderNormal, 0)
}
has_invis[id] = false
}