-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvip_weapons.sma
127 lines (106 loc) · 2.33 KB
/
vip_weapons.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#define USE_ENGINE //<-alternative fakemeta
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#if defined USE_ENGINE
#include <engine>
#endif
#define PLUGIN "vip_weapons"
#define VERSION "1.1e"
#define AUTHOR "mlibre"
#if AMXX_VERSION_NUM < 183
#define MAX_PLAYERS 32
#define MAX_RESOURCE_PATH_LENGTH 64
#endif
const ADMIN_VIP_FLAG = ADMIN_LEVEL_C //<-users.ini ; "o" - custom level C
enum _:xData
{
csw_name, model_path[MAX_RESOURCE_PATH_LENGTH]
}
new const xWeapon[][xData] =
{
{
CSW_M4A1, "models/vip_weapons/v_m4a1.mdl"
},
{
CSW_AK47, "models/vip_weapons/v_ak47.mdl"
},
{
CSW_DEAGLE, "models/vip_weapons/v_deagle.mdl"
},
{
CSW_USP, "models/vip_weapons/v_usp.mdl"
},
{
CSW_FAMAS, "models/vip_weapons/v_famas.mdl"
},
{
CSW_SG550, "models/vip_weapons/v_sg550.mdl"
},
{
CSW_AWP, "models/vip_weapons/v_awp.mdl"
},
{
CSW_XM1014, "models/vip_weapons/v_xm1014.mdl"
}
}
public plugin_precache()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
for(new i, weapon_name[MAX_PLAYERS]; i < sizeof xWeapon; i++)
{
if(file_exists(xWeapon[i][model_path]))
{
precache_model(xWeapon[i][model_path])
}
else
{
#if AMXX_VERSION_NUM <= 182
new sfs[MAX_RESOURCE_PATH_LENGTH * 2]; formatex(sfs, charsmax(sfs), "No exist: ^"%s^"", xWeapon[i][model_path])
set_fail_state(sfs)
#else
set_fail_state("No exist: ^"%s^"", xWeapon[i][model_path])
#endif
}
get_weaponname(xWeapon[i][csw_name], weapon_name, charsmax(weapon_name))
RegisterHam(Ham_Item_Deploy, weapon_name, "Ham_Item_Deploy_Post", true)
}
}
// offsets
#define XO_WEAPON 4
#define m_pPlayer 41
#define m_iId 43
enum
{
TERRORIST = 1,
CT
}
public Ham_Item_Deploy_Post(iEnt)
{
#if defined USE_ENGINE
if( !is_valid_ent(iEnt) )
#else
if( !pev_valid(iEnt) )
#endif
return HAM_IGNORED
new id = get_pdata_cbase(iEnt, m_pPlayer, XO_WEAPON)
if(id < 1 || id > MAX_PLAYERS || ~get_user_flags(id) & ADMIN_VIP_FLAG)
return HAM_IGNORED
if(get_user_team(id) == CT)
{
new iWeapon = get_pdata_int(iEnt, m_iId, XO_WEAPON)
for(new i; i < sizeof xWeapon; i++)
{
if(iWeapon == xWeapon[i][csw_name])
{
#if defined USE_ENGINE
entity_set_string(id, EV_SZ_viewmodel, xWeapon[i][model_path])
#else
set_pev(id, pev_viewmodel2, xWeapon[i][model_path])
#endif
break
}
}
}
return HAM_IGNORED
}