-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlwf_item_invisibility.sma
67 lines (55 loc) · 1.38 KB
/
lwf_item_invisibility.sma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <fakemeta>
#include <jctf>
native Float:halflife_time()
new Float:fPtime[MAX_PLAYERS]
new bool:buyed[MAX_PLAYERS]
public plugin_init()
{
register_forward(FM_AddToFullPack, "AddToFullPack", 1)
register_event_ex("DeathMsg", "Ev_ClientDeath", RegisterEvent_Global)
shop_add_item("MENU_SPITEMS_OP_1", 90, "buy_invisibility")
}
public client_disconnected(id)
{
buyed[id] = false
}
public buy_invisibility(id)
{
if(buyed[id])
{
client_print(id, print_chat, "No puedes comprar este item nuevamente mientras esta en uso.")
return PLUGIN_HANDLED
}
fPtime[id] = halflife_time() + 20.0
buyed[id] = true
client_print(id, print_chat, "Has comprado invisibilidad por 20 segundos.")
return PLUGIN_CONTINUE
}
public AddToFullPack(es, e, ent, host, flags, player, set)
{
if(!player)
{
return
}
if(buyed[ent])
{
set_es(es, ES_Effects, EF_NODRAW)
client_print(ent, print_center, "Invisibilidad: %0.1f segundo%s", fPtime[ent] - halflife_time(), (fPtime[ent] - halflife_time() > 1.9 ? "s" : ""))
if(halflife_time() >= fPtime[ent] - 0.1)
{
client_print(ent, print_chat, "Se te han acabado los 20 segundos de invisibilidad.")
buyed[ent] = false
}
}
}
public Ev_ClientDeath()
{
new v = read_data(2)
if(buyed[v])
{
buyed[v] = false
client_print(v, print_chat, "Moriste y perdiste la invisibilidad.")
}
}