-
Notifications
You must be signed in to change notification settings - Fork 1
/
td_shop_golden_ammo_pistols.sma
101 lines (83 loc) · 2.85 KB
/
td_shop_golden_ammo_pistols.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include <amxmodx>
#include <amxmisc>
#include <td>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "TD: Shop | Zlote naboje [PISTOLETY]"
#define VERSION "1.0"
#define AUTHOR "tomcionek15 & grs4"
new iItem;
new g_PlayerAmmo[33];
new m_spriteTexture
public plugin_init()
{
new id = register_plugin(PLUGIN, VERSION, AUTHOR)
iItem = td_shop_register_item("Zlote naboje - PISTOLETY", "Otrzymujesz 100 zlotych naboi do pistoletow. Zadajesz 1.5x wiecej obrazen", 130, 0, id)
RegisterHam(Ham_TraceAttack, "info_target", "TraceAttack")
RegisterHam(Ham_TraceAttack, "worldspawn", "TraceAttackW", 1)
}
public client_disconnected(id)
g_PlayerAmmo[id] = 0
public td_shop_item_selected(id, itemid) {
if(iItem == itemid) {
set_task(0.3, "info", id)
g_PlayerAmmo[id] += 100
}
}
public info(id) {
if(is_user_connected(id)) {
if(!g_PlayerAmmo[id])
client_print(id, print_chat, "[ZLOTE NABOJE] Gotowe do uzytku!");
if(g_PlayerAmmo[id])
client_print(id, print_chat, "[ZLOTE NABOJE] Pozostalo %d zlotych naboi do pistoletow!", g_PlayerAmmo[id]);
}
}
public plugin_precache()
m_spriteTexture = precache_model( "sprites/lgtning.spr" )
public TraceAttackW(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageTaype)
{
if( !is_user_alive(iAttacker) || !g_PlayerAmmo[iAttacker])
return HAM_IGNORED;
static weapon
weapon = get_user_weapon(iAttacker);
if(weapon != CSW_USP && weapon != CSW_GLOCK18 && weapon != CSW_FIVESEVEN && weapon != CSW_ELITE && weapon != CSW_P228 && weapon != CSW_DEAGLE)
return HAM_IGNORED;
client_print(iAttacker, print_center, "Zlote naboje PISTOLETY:: %d", g_PlayerAmmo[iAttacker])
return HAM_IGNORED
}
public TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageTaype)
{
if( !is_user_alive(iAttacker) || !g_PlayerAmmo[iAttacker])
return HAM_IGNORED;
static weapon
weapon = get_user_weapon(iAttacker);
if(weapon != CSW_USP && weapon != CSW_GLOCK18 && weapon != CSW_FIVESEVEN && weapon != CSW_ELITE && weapon != CSW_P228 && weapon != CSW_DEAGLE)
return HAM_IGNORED;
if(iEnt == 0)
return HAM_IGNORED
g_PlayerAmmo[iAttacker] --;
new Float:flEnd[3]
get_tr2(ptr, TR_vecEndPos, flEnd)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY )
write_byte(TE_BEAMENTPOINT)
write_short(iAttacker | 0x1000)
write_coord_f(flEnd[0])
write_coord_f(flEnd[1])
write_coord_f(flEnd[2])
write_short(m_spriteTexture)
write_byte(0) // framerate
write_byte(0) // framerate
write_byte(1) // life
write_byte(10) // width
write_byte(0) // noise
write_byte(random_num(230,255)) // r, g, b
write_byte(random_num(215, 255)) // r, g, b
write_byte(0) // r, g, b
write_byte(128) // brightness
write_byte(10) // speed
message_end()
client_print(iAttacker, print_center, "Zlote naboje - PISTOLET: %d", g_PlayerAmmo[iAttacker])
if(td_is_monster(iEnt))
SetHamParamFloat(3, flDamage*1.5);
return HAM_HANDLED;
}