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:
|
damageModel()
{
bullet = spawn( "script_model", self.origin );
bullet setModel( "xmodel/tombstone1" );
bullet.angles = ( 0, 0, 0 );
bullet setCanDamage(1); // turn damage monitor on
bullet setContents(1); // bullet will collide with model
bullet.health = 1000;
while( bullet.health > 0 )
{
// wait for damage...
bullet waittill("dmg", dmg, who, weap, point, mod);
bullet.health -= dmg;
iPrintln("dmg:" + dmg + "; who:" + who.name + "; mod:" + mod);
}
}
setCanDamage( flag )
{
if( !isDefined( self.bashradius ) )
self.bashradius = 32;
if( !flag )
{
self notify("kill_damagemonitor");
return;
}
else
self thread setCanDamage2();
}
setCanDamage2()
{
self endon("kill_damagemonitor");
trace = undefined;
while( 1 )
{
players = getEntArray( "player", "classname" );
for( i = 0; i < players.size; i++ )
{
p = players[i];
if( !isDefined( p.bash_delay ) )
p.bash_delay = false;
forward = vectorscale( anglesToForward(p getPlayerAngles()), 10000 );
startOrigin = p getEye() + (0,0,20);
endOrigin = startOrigin + forward;
trace = bulletTrace( startOrigin, endOrigin, true, p );
distance = distance ( self.origin, p.origin ) ;
wait 0.05;
if( isDefined( trace["entity"] ) && trace["entity"] == self )
{
if( p attackButtonPressed() && isWeapon( p getCurrentWeapon() ) && p getWeaponSlotClipAmmo(p getCurrentSlot()) > 0)
{
weap = p getCurrentWeapon();
dmg = getDamage( weap );
who = p;
point = trace["position"];
mod = damageMod( weap );
self notify("dmg", dmg, who, weap, point, mod);
}
if ( p meleeButtonPressed() && !p.bash_delay && distance( p.origin, self.origin ) < self.bashradius )
{
p thread bash_delay( 0.6 );
weap = p getCurrentWeapon();
dmg = getDamage( weap );
who = p;
point = trace["position"];
mod = "MOD_MELEE";
self notify("dmg", dmg, who, weap, point, mod);
}
}
}
wait 0.05;
}
}
bash_delay( time )
{
self endon("disconnected");
self.bash_delay = true;
wait time;
self.bash_delay = false;
}
getDamage(weapon)
{
switch(weapon)
{
case "springfield_mp":
return 50;
case "enfield_scope_mp":
return 50;
case "mosin_nagant_sniper_mp":
return 50;
case "kar98k_sniper_mp":
return 50;
case "mosin_nagant_mp":
return 50;
case "kar98k_mp":
return 50;
case "m1carbine_mp":
return 38;
case "m1garand_mp":
return 38;
case "enfield_mp":
return 50;
case "SVT40_mp":
return 38;
case "g43_mp":
return 38;
case "bar_mp":
return 40;
case "bren_mp":
return 40;
case "mp44_mp":
return 40;
case "thompson_mp":
return 35;
case "sten_mp":
return 33;
case "greasegun_mp":
return 34;
case "mp40_mp":
return 36;
case "ppsh_mp":
return 30;
case "PPS42_mp":
return 40;
case "shotgun_mp":
return 40;
case "panzerschreck_mp":
return 400;
case "TT30_mp":
return 20;
case "webley_mp":
return 20;
case "colt_mp":
return 20;
case "luger_mp":
return 20;
default:
return 70;
}
}
damageMod(weapon)
{
switch(weapon)
{
case "springfield_mp":
case "enfield_scope_mp":
case "mosin_nagant_sniper_mp":
case "kar98k_sniper_mp":
case "mosin_nagant_mp":
case "kar98k_mp":
case "enfield_mp":
return "MOD_RIFLE_BULLET";
case "m1carbine_mp":
case "m1garand_mp":
case "SVT40_mp":
case "g43_mp":
case "bar_mp":
case "bren_mp":
case "mp44_mp":
case "thompson_mp":
case "sten_mp":
case "greasegun_mp":
case "mp40_mp":
case "ppsh_mp":
case "PPS42_mp":
case "shotgun_mp":
return "MOD_RIFLE_BULLET";
case "TT30_mp":
case "webley_mp":
case "colt_mp":
case "luger_mp":
return "MOD_PISTOL_BULLET";
case "panzerschreck_mp":
case "panzerfaust_mp":
return"MOD_PROJECTILE";
default:
return "MOD_UNKNOWN";
}
} |