Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

[CS 1.6] Addon - Gold Weapon

A Config Script for Counter-Strike 1.6

No ads for members. Membership is 100% free. Sign up!
481 13 kb Raw Code
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta_util>

enum _:eVipType {       Null = 0,       ViP,    ViPGold };
enum _:eGoldList{       Knife = 0,      Deagle, Awp,    Ak47,   M4A1    };

#define VipFlag "b"
#define VipFlagGold     "t"

#define MinRoundToOpenMenu              2
#define AWP_LIMIT       10     
#define AK47_LIMIT      7
#define M4A1_LIMIT      5

#define Damage_Awp              2.6
#define Damage_Ak4              1.6
#define Damage_M4A1             1.9
#define Damage_Deagle   2.5

#define DROP_TYPE       2       // 1 - regular drop. 2 - removed from the hands of all

new szGoldV[eGoldList][32] = {
        "models/gold/v_knife.mdl",
        "models/gold/v_g_deagle.mdl",
        "models/gold/v_g_awp.mdl",
        "models/gold/v_g_ak47.mdl",
        "models/gold/v_m4a1gold.mdl"
};

new szGoldP[eGoldList][32] = {
        "models/gold/p_knife.mdl",
        "models/gold/p_g_deagle.mdl",
        "models/gold/p_g_awp.mdl",
        "models/gold/p_g_ak47.mdl",
        "models/gold/p_m4a1gold.mdl"
};

new szGoldW[eGoldList][32] = {
        "",
        "models/gold/w_g_deagle.mdl",
        "models/gold/w_g_awp.mdl",
        "models/gold/w_g_ak47.mdl",
        "models/gold/w_m4a1gold.mdl"
};

enum _:eKeyGold{
        _Deagle = 36895,
        _Awp,
        _Ak47,
        _M4A1
};

enum _:eGoldCost{
        Cost_Awp = 12300,
        Cost_Ak4 = 5200,
        Cost_M4A1 = 9100
};

new iVipFlag[33], bool:bDefuse, iRoundNum;

public plugin_init()
{
        register_plugin("[AMXX] ViP Gold", "1.0", "Flymic24");
       
        register_event("TextMsg",       "Event_RoundRestart",   "a",    "2&#Game_C",    "2&#Game_w");
        register_event("HLTV",          "Event_RoundStart",             "a",    "1=0",                  "2=0");
       
        register_message(get_user_msgid("ScoreAttrib"), "MessageScoreAttrib");
       
        if(engfunc(EngFunc_FindEntityByString, FM_NULLENT, "classname", "func_bomb_target"))
                bDefuse = true;
       
        RegisterHam(Ham_Spawn, "player", "HamHook_Player_Spawn", true);
       
        RegisterHam(Ham_Item_Deploy,    "weapon_knife", "HamHook_Knife_Deploy", true);
        RegisterHam(Ham_Item_Deploy,    "weapon_ak47""HamHook_Item_Deploy",  true);
        RegisterHam(Ham_Item_Deploy,    "weapon_awp",   "HamHook_Item_Deploy",  true);
        RegisterHam(Ham_Item_Deploy,    "weapon_m4a1""HamHook_Item_Deploy",  true);
        RegisterHam(Ham_Item_Deploy,    "weapon_deagle","HamHook_Item_Deploy",  true);
       
        RegisterHam(Ham_Touch,  "weapon_ak47""HamHook_Item_AttachToPlayer",  false);
        RegisterHam(Ham_Touch,  "weapon_m4a1""HamHook_Item_AttachToPlayer",  false);
        RegisterHam(Ham_Touch,  "weapon_awp",   "HamHook_Item_AttachToPlayer",  false);
        RegisterHam(Ham_Touch,  "weapon_deagle","HamHook_Item_AttachToPlayer",  false);
       
        RegisterHam(Ham_TraceAttack,    "func_breakable",       "HamHook_Entity_TraceAttack",   false);
        RegisterHam(Ham_TraceAttack,    "hostage_entity",       "HamHook_Entity_TraceAttack",   false);
        RegisterHam(Ham_TraceAttack,    "info_target",          "HamHook_Entity_TraceAttack",   false);
        RegisterHam(Ham_TraceAttack,    "player",                       "HamHook_Entity_TraceAttack",   false);
       
        register_forward(FM_SetModel, "Fakemeta_SetModel")
       
        register_clcmd("say /vipmenu", "WeaponMenu");
        register_clcmd("vipmenu", "WeaponMenu");
       
        register_menucmd(register_menuid("Vip Menu"), 1023, "VipHandler");
}

public plugin_precache()
{
        for(new i = 0; i < sizeof(szGoldV); i++)        if (szGoldV[i][0])      precache_model(szGoldV[i]);
        for(new i = 0; i < sizeof(szGoldP); i++)        if (szGoldP[i][0])      precache_model(szGoldP[i]);
        for(new i = 0; i < sizeof(szGoldW); i++)        if (szGoldW[i][0])      precache_model(szGoldW[i]);
}

public client_putinserver(iPlayer)
{
        if (GetUserFlags(iPlayer) == Null)
                return;
       
        new szName[32]; get_user_name(iPlayer, szName, charsmax(szName));
        UtilChatColor(0, "The server went !gVIP !client !team%s", szName);
}

public Event_RoundRestart()     iRoundNum = 0;
public Event_RoundStart()       iRoundNum++;

public MessageScoreAttrib(iMsgId, iDest, iReceiver)
{
        new iPlayer = get_msg_arg_int(1);
       
        if(iVipFlag[iPlayer] > Null && !get_msg_arg_int(2))
                set_msg_arg_int(2, ARG_BYTE, (1<<2));
}

public HamHook_Knife_Deploy(const iItem)
{
        if (pev_valid(iItem) != 2)
                return HAM_IGNORED;
       
        new iPlayer = get_pdata_cbase(iItem, 41, 4);
       
        if(iVipFlag[iPlayer] != ViPGold)
                return HAM_IGNORED;
       
        set_pev(iPlayer, pev_viewmodel2, szGoldV[ Knife ]);
        set_pev(iPlayer, pev_weaponmodel2, szGoldP[ Knife ]);
       
        return HAM_IGNORED;
}

public HamHook_Item_Deploy(const iItem)
{
        if (pev_valid(iItem) != 2)
                return HAM_IGNORED;
       
        new iIndex = 0;
       
        switch(pev(iItem, pev_impulse))
        {
                case _Ak47:     iIndex = Ak47;
                case _Awp:      iIndex = Awp;
                case _M4A1:     iIndex = M4A1;
                case _Deagle:   iIndex = Deagle;
                default: return HAM_IGNORED;
        }
       
        if (iIndex)
        {
                new iPlayer = get_pdata_cbase(iItem, 41, 4);
                set_pev(iPlayer, pev_viewmodel2, szGoldV[ iIndex ]);
                set_pev(iPlayer, pev_weaponmodel2, szGoldP[ iIndex ]);
        }
       
        return HAM_IGNORED;
}

public HamHook_Item_AttachToPlayer(const iItem, const iPlayer)
{
        if (!pev_valid(iItem))
                return HAM_IGNORED;
       
        switch(pev(iItem, pev_impulse))
        {
                case _Deagle.._M4A1:
                {
                        if (iVipFlag[iPlayer] != ViPGold)
                                return HAM_SUPERCEDE;
                }
                default: return HAM_IGNORED;
        }
       
        return HAM_IGNORED;
}

public HamHook_Entity_TraceAttack(const iEntity, const iAttacker, Float:flDamage)
{
        if (!is_user_alive(iAttacker) || !pev_valid(iEntity))
                return HAM_IGNORED;
       
        new iItem = get_pdata_cbase(iAttacker, 373, 5);
       
        if (!pev_valid(iItem))  return HAM_IGNORED;
       
        new Float:iIndex;
       
        switch(pev(iItem, pev_impulse))
        {
                case _Ak47:     iIndex = Damage_Ak4;
                case _Awp:      iIndex = Damage_Awp;
                case _M4A1:     iIndex = Damage_M4A1;
                case _Deagle:   iIndex = Damage_Deagle;
                default: return HAM_IGNORED;
        }
       
        if (iIndex)     SetHamParamFloat(3, flDamage * iIndex);
       
        return HAM_IGNORED;
}

public HamHook_Player_Spawn(const iPlayer)
{
        if (!is_user_alive(iPlayer) || is_user_bot(iPlayer))
                return HAM_IGNORED;
       
        if (iVipFlag[iPlayer] <= Null)
                return HAM_IGNORED;
       
        give_item_ex2(iPlayer, "weapon_hegrenade", 21);
        give_item_ex2(iPlayer, "weapon_flashbang", 22);
        give_item_ex2(iPlayer, "weapon_smokegrenade", 21);
       
        if (!user_has_weapon(iPlayer, CSW_DEAGLE))
        {
                give_item_ex2(iPlayer, "weapon_deagle", 35, true, (iVipFlag[iPlayer] == ViPGold) ? _Deagle : Null);
        }
       
        cs_set_user_armor(iPlayer, 900, CS_ARMOR_VESTHELM);
       
        if(bDefuse && cs_get_user_team(iPlayer) == CS_TEAM_CT)
                cs_set_user_defuse(iPlayer, 1);
       
        return HAM_IGNORED;
}

public Fakemeta_SetModel(const iEntity, szModel[])
{
        if(!pev_valid(iEntity))
                return FMRES_IGNORED;
       
        new szClassName[32];
        pev(iEntity, pev_classname, szClassName, charsmax(szClassName));
       
        if (!equali(szClassName, "weaponbox"))
                return FMRES_IGNORED;
       
        for(new iSlot, iWeapon, iIndex; iSlot < 6; iSlot++)
        {
                iWeapon = get_pdata_cbase(iEntity, 34 + iSlot, 4);
               
                if (pev_valid(iWeapon))
                {
                        switch(pev(iWeapon, pev_impulse))
                        {
                                case _Ak47:     iIndex = Ak47;
                                case _Awp:      iIndex = Awp;
                                case _M4A1:     iIndex = M4A1;
                                case _Deagle:   iIndex = Deagle;
                        }
                       
                        if (iIndex)
                        {
                                engfunc(EngFunc_SetModel, iEntity, szGoldW[iIndex]);
                                return FMRES_SUPERCEDE;
                        }
                }
        }
       
        return FMRES_IGNORED;
}

public WeaponMenu(iPlayer)
{
        if (!is_user_alive(iPlayer) || iVipFlag[iPlayer] <= Null)
                return PLUGIN_HANDLED;
       
        if (iRoundNum < MinRoundToOpenMenu)
        {
                UtilChatColor(iPlayer, "!g[!yViP!g] !Menu not available. expect more !team%i !round", MinRoundToOpenMenu - iRoundNum);
                return PLUGIN_HANDLED;
        }
       
        static szMenu[512], iLen;

        iLen = formatex(szMenu, charsmax(szMenu), "\r[\yVIP\r] \wWeaponMenu^n^n");
       
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "1.take AK47");
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "2.take M4A1");
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "3.take AWP");
       
        if (iVipFlag[iPlayer] == ViPGold)
        {
                if(iRoundNum < AK47_LIMIT)
                        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "4.take AK47 Gold \r[c %d round]^n", AK47_LIMIT);
                else
                        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "4.take AK47 Gold \y(\r%i$\y)^n", Cost_Ak4);

                if(iRoundNum < M4A1_LIMIT)
                        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "5.take M4A1 Gold \r[c %d round]^n", M4A1_LIMIT);
                else
                        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "5.take M4A1 Gold \y(\r%i$\y)^n", Cost_M4A1);

                if(iRoundNum < AWP_LIMIT)
                        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "6.take AWP Gold \r[c %d round]^n", AWP_LIMIT);
                else
                        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "6.take AWP Gold \y(\r%i$\y)^n", Cost_Awp);
        }
       
        iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\y0. \Exit");
       
        set_pdata_int(iPlayer, 205, 0);
       
        show_menu(iPlayer, 1023, szMenu, -1, "Vip Menu");
       
        return PLUGIN_HANDLED;
}

public VipHandler(iPlayer, iKey)
{
        if (!is_user_alive(iPlayer))
                return PLUGIN_HANDLED;
       
        new iNewKey = iKey + 1;
       
        static szWeaponName[][] = {     "", "AK", "M4", "AWP", "Gold AK", "Gold M4", "Gold AWP" };
        static szChoosedWP[][] = {      "", "weapon_ak47", "weapon_m4a1", "weapon_awp"  };
        static szChoosedBP[] = {        0, 240, 240, 240, 60    };
        static iGoldKey[] = {   0, _Ak47, _M4A1, _Awp   };
        static iCost[] = {      0, Cost_Ak4, Cost_M4A1, Cost_Awp        };
        static iRoundLimit[] = {        0, AK47_LIMIT, M4A1_LIMIT, AWP_LIMIT    };
       
        switch (iNewKey)
        {
                case 1..3:      give_item_ex2(iPlayer, szChoosedWP[iNewKey], szChoosedBP[iNewKey], true);
                case 4..6:
                {
                        new iMoney = cs_get_user_money(iPlayer);
                       
                        if (iRoundNum < iRoundLimit[iNewKey - 3])
                        {
                                UtilChatColor(iPlayer, "!g[!yViP!g] !Available only with !g%i !round", iRoundLimit[iNewKey - 3]);
                                return PLUGIN_HANDLED;                         
                        }
                        if (iMoney < iCost[iNewKey - 3] || iVipFlag[iPlayer] != ViPGold)
                        {
                                UtilChatColor(iPlayer, "!g[!yViP!g] !Not enough money: !team%i!g$", iCost[iNewKey - 3]);
                                return PLUGIN_HANDLED;
                        }
                        else
                        {
                                give_item_ex2(iPlayer, szChoosedWP[iNewKey - 3], szChoosedBP[iNewKey - 3], true, iGoldKey[iNewKey - 3]);
                                cs_set_user_money(iPlayer, iMoney - iCost[iNewKey - 3]);
                        }
                }
                default:        return PLUGIN_HANDLED;
        }
       
        UtilChatColor(iPlayer, "!g[!yViP!g] !You received: !g[!team%s!g]", szWeaponName[iNewKey]);
       
        return PLUGIN_HANDLED;
}

stock give_item_ex2(iPlayer, const szWeaponName[], iAmmo = 0, bool:bDrop = false, iKey = 0)
{
        if (!equal(szWeaponName, "weapon_", 7))
                return false;
       
        new iWeapon = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, szWeaponName));
       
        if (!pev_valid(iWeapon))
                return false;
       
        if (bDrop)
        {
                new szWeapon[ 32 ],
                        iSlot = ExecuteHamB(Ham_Item_ItemSlot, iWeapon),
                        iItem = get_pdata_cbase(iPlayer, 367 + iSlot, 5);
               
                while ((pev_valid(iItem) == 2))
                {
                        pev(iItem, pev_classname, szWeapon, charsmax(szWeapon));
                       
                        switch(DROP_TYPE)
                        {
                                case 1: engclient_cmd(iPlayer, "drop", szWeapon);
                                case 2: ham_strip_weapon(iPlayer, szWeapon);
                        }
                       
                        iItem = get_pdata_cbase(iItem, 42, 4);
                }
        }
       
        set_pev(iWeapon, pev_spawnflags, pev(iWeapon, pev_spawnflags) | SF_NORESPAWN);
       
        if (iKey > 0)   set_pev(iWeapon, pev_impulse, iKey);
        if (iAmmo > 0)  cs_set_user_bpammo(iPlayer, get_weaponid(szWeaponName), iAmmo);
       
        dllfunc(DLLFunc_Spawn, iWeapon);
        dllfunc(DLLFunc_Touch, iWeapon, iPlayer);
       
        return true;
}

stock ham_strip_weapon(id, weapon[])
{
    if(!equal(weapon,"weapon_",7)) return 0
   
    new wId = get_weaponid(weapon)
    if(!wId) return 0
   
    new wEnt
    while((wEnt = engfunc(EngFunc_FindEntityByString, wEnt, "classname", weapon)) && pev(wEnt, pev_owner) != id) {}
    if(!wEnt) return 0
   
    new iTmp
    if(get_user_weapon(id, iTmp, iTmp) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon, wEnt)
   
    if(!ExecuteHamB(Ham_RemovePlayerItem, id, any:wEnt)) return 0
   
    ExecuteHamB(Ham_Item_Kill, wEnt)
    set_pev(id, pev_weapons, pev(id, pev_weapons) & ~(1<<wId))
   
    return 1
}

stock GetUserFlags(const iPlayer)
{
        if (!is_user_connected(iPlayer))
                return -1;
       
        new iFlags = get_user_flags(iPlayer);
        new iReturnBit;
       
        if (iFlags & read_flags(VipFlagGold))
        {
                iVipFlag[iPlayer] = ViPGold;
                iReturnBit = ViPGold;
        }
        else if (iFlags & read_flags(VipFlag))
        {
                iVipFlag[iPlayer] = ViP;
                iReturnBit = ViP;
        }
        else
        {
                iVipFlag[iPlayer] = Null;
                iReturnBit = Null;
        }
       
        return iReturnBit;
}

stock UtilChatColor(const iPlayer, const szInput[], any:...)
{
        new iCount = 1, szPlayers[32];
        static szMessage[191];
       
        vformat(szMessage, charsmax(szMessage), szInput, 3);
       
        replace_all(szMessage, charsmax(szMessage), "!g", "^4");        // Green Color
        replace_all(szMessage, charsmax(szMessage), "!y", "^1");        // Default Color
        replace_all(szMessage, charsmax(szMessage), "!team", "^3");     // Team Color
       
        static g_SayText;
        if (!g_SayText) g_SayText = get_user_msgid("SayText");
       
        if(iPlayer) szPlayers[0] = iPlayer; else get_players(szPlayers, iCount, "ch");
        {
                for(new i = 0; i < iCount; i++)
                {
                        if(!is_user_connected(szPlayers[i]))    continue;
                       
                        message_begin(MSG_ONE_UNRELIABLE, g_SayText, _, szPlayers[i]);
                        write_byte(szPlayers[i]);
                        write_string(szMessage);
                        message_end();
                }
        }
}
Plugin  Gold Weapon  will expand the range of weapons on your server CS 1.6. Thanks to him, the players will be able to acquire  the gold models of the weapon  and stand out among the usual visitors to your server.

Description:
Normal the VIP:

- ability to take a full set of grenades;
- issued free of charge armor;
- CT receive free "defyuzy" (curling) of clearance C4.

The VIP Gold:

- has all the features of conventional VIP'a;
- the possibility of taking the golden Deagle;
- the possibility of taking a golden knife;
- the ability to use special weapons increased.

List of golden weapons:

- Golden AK-47;
- Golden M4A1;
- Gold AWM
- Golden Deagle;
- Golden knife.

https://www.dropbox.com/s/31sy8ilr3u8hepg/1558293236_amxx_gold_weapon.rar?dl=0
Sign up to access this!

No comments yet

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Credits

cs-dev.ru
cs-dev.ru

Submitter

Rainbowdash98 avatar
Rainbowdash98 Joined 4y ago
Offline
Rainbowdash98
Redistributor
Are you the owner? Request Ownership
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

License

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • 0
  • 583
  • 2mo

More from Submitter

More AMX/X Scripts Scripts