-
Notifications
You must be signed in to change notification settings - Fork 0
/
item.gsc
executable file
·138 lines (115 loc) · 2.88 KB
/
item.gsc
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
precache()
{
precacheModel("xmodel/prop_mortar_crate2");
precacheModel("xmodel/prop_crate_dak5");
precacheModel("xmodel/health_small");
precacheModel("xmodel/health_medium");
}
spawnRadiusTrigger(function)
{
entity = self;
entity.useTrigger = true;
trigger = spawn("trigger_radius", entity.origin, 0, 25, 25);
entity.trigger = trigger; // for later movement/deletion etc.
while (1)
{
trigger waittill("trigger", player);
if (entity.useTrigger == false)
{
wait 0.10;
continue;
}
entity [[function]](player);
wait 0.10;
}
}
funcAmmoMedium(player)
{
entity = self;
entity.useTrigger = false;
entity hide();
/*
getweaponslotweapon
setweaponslotweapon
getweaponslotammo
setweaponslotammo
getweaponslotclipammo
setweaponslotclipammo
setweaponclipammo
*/
player playsound("weap_pickup");
if ( ! player hasWeapon(player.pers["weapon"]))
player giveWeapon(player.pers["weapon"]);
player giveMaxAmmo(player.pers["weapon"]);
player switchToWeapon(player.pers["weapon"]);
// cant add 2/3 to current ammo, coz i cant get maxammo...
//slot = self getweaponslotweapon(player.pers["weapon"]);
//self setweaponslotclipammo(slot, self getweaponslotclipammo(slot) + (self getweaponslotclipammo(slot) * 2/3));
wait 30;
entity.useTrigger = true;
entity show();
}
funcHealthMedium(player)
{
entity = self;
entity.useTrigger = false;
entity hide();
player playsound("weap_pickup");
player.health += int(player.maxhealth * 0.5);
if (player.health > player.maxhealth)
player.health = player.maxhealth;
wait 30;
entity.useTrigger = true;
entity show();
}
funcHealthSmall(player)
{
entity = self;
entity.useTrigger = false;
entity hide();
player playsound("weap_pickup");
player.health += int(player.maxhealth * 0.25);
if (player.health > player.maxhealth)
player.health = player.maxhealth;
wait 30;
entity.useTrigger = true;
entity show();
}
addItem(name, origin, angles)
{
model = undefined;
switch (name)
{
case "item_ammopack_small":
model = std\entity::spawnModel("xmodel/prop_mortar_crate2", origin + (0,0,0), angles);
model thread spawnRadiusTrigger(::funcAmmoMedium);
break;
case "item_ammopack_medium":
model = std\entity::spawnModel("xmodel/prop_crate_dak5", origin + (0,0,0), angles);
model thread spawnRadiusTrigger(::funcAmmoMedium);
break;
case "item_healthkit_small":
model = std\entity::spawnModel("xmodel/health_small", origin + (0,0,0), angles);
model thread spawnRadiusTrigger(::funcHealthSmall);
break;
case "item_healthkit_medium":
model = std\entity::spawnModel("xmodel/health_medium", origin + (0,0,0), angles);
model thread spawnRadiusTrigger(::funcHealthMedium);
break;
}
if (!isDefined(model))
return;
model thread animate();
}
animate()
{
while (1)
{
self rotateYaw(360, 2);
self moveZ(25, 2);
wait 2;
self rotateYaw(360, 2);
self moveZ(-25, 2);
wait 2;
}
}