forked from Mistrick/DeathrunMod
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeathrun_mode_free.sma
77 lines (67 loc) · 1.52 KB
/
deathrun_mode_free.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
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#include <deathrun_modes>
#define PLUGIN "Deathrun Mode: Free"
#define VERSION "1.0.1"
#define AUTHOR "Mistrick"
#pragma semicolon 1
#define MAX_HEALTH 100
new g_iModeFree, g_iCurMode, g_iMaxPlayers;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event("Health", "Event_Health", "b");
new CSW_IGNORED = (1 << CSW_KNIFE);
for(new i = CSW_P228, szWeaponName[32]; i <= CSW_P90; i++)
{
if(~CSW_IGNORED & 1<<i && get_weaponname(i, szWeaponName, charsmax(szWeaponName)))
{
RegisterHam(Ham_Item_AddToPlayer, szWeaponName, "Ham_Item_AddToPlayer_Pre", 0);
}
}
g_iModeFree = dr_register_mode
(
.Name = "DRM_MODE_FREE",
.Mark = "free",
.RoundDelay = 0,
.CT_BlockWeapons = 1,
.TT_BlockWeapons = 1,
.CT_BlockButtons = 0,
.TT_BlockButtons = 1,
.Bhop = 1,
.Usp = 0,
.Hide = 0
);
g_iMaxPlayers = get_maxplayers();
}
//***** Events *****//
public Event_Health(id)
{
if(g_iCurMode == g_iModeFree && (get_user_health(id) > MAX_HEALTH))
{
set_user_health(id, MAX_HEALTH);
client_print(id, print_center, "You can't have more than %d hp.", MAX_HEALTH);
}
}
//***** Ham *****//
public Ham_Item_AddToPlayer_Pre(ent, id)
{
return (g_iCurMode == g_iModeFree) ? HAM_SUPERCEDE : HAM_IGNORED;
}
//***** *****//
public dr_selected_mode(id, mode)
{
g_iCurMode = mode;
if(g_iModeFree == mode)
{
for(new i = 1; i <= g_iMaxPlayers; i++)
{
if(is_user_alive(i))
{
strip_user_weapons(i);
give_item(i, "weapon_knife");
}
}
}
}