[Half-Life AMXX] / amxmod_compat / vexdum.sma Repository:
ViewVC logotype

Annotation of /amxmod_compat/vexdum.sma

Parent Directory Parent Directory | Revision Log Revision Log


Revision 44 - (view) (download)

1 : ian 1 /**
2 :     * AMX Mod Compatibility engine
3 :     * by the AMX Mod X Development Team
4 :     */
5 :    
6 :     #include <VexdUM_const>
7 :     #include <VexdUM_stock>
8 :    
9 :     /* Forwards */
10 :     new g_FwdTouch
11 :     new g_FwdThink
12 :     new g_FwdSpawn
13 :     new g_FwdClientPreThink
14 :     new g_FwdClientPostThink
15 :     new g_FwdEmitSound
16 :     new g_FwdEmitAmbientSound
17 :     new g_FwdSetModel
18 :     new g_FwdTraceLine
19 :     new g_FwdSetCliKeyValue
20 :     new g_FwdKeyValue
21 :     new g_PlayerModels[33][64]
22 :     new g_PlayerModeled[33]
23 :    
24 :     /* User Messages */
25 :     new g_msgDamage
26 :     new g_msgDeathMsg
27 :     new g_msgScoreInfo
28 :    
29 :     new g_LastTrace = 0
30 :    
31 :     VexdUM_Register()
32 :     {
33 :     /* Fakemeta Hooks */
34 :     register_forward(FM_EmitSound, "Hook_FM_EmitSound")
35 :     register_forward(FM_EmitAmbientSound, "Hook_FM_EmitAmbientSound")
36 :     register_forward(FM_SetModel, "Hook_FM_SetModel")
37 :     register_forward(FM_SetClientKeyValue, "Hook_FM_SetClientKeyValue")
38 :     register_forward(FM_KeyValue, "Hook_FM_KeyValue")
39 :     register_forward(FM_Touch, "Hook_FM_Touch")
40 :     register_forward(FM_Think, "Hook_FM_Think")
41 :     register_forward(FM_Spawn, "Hook_FM_Spawn")
42 :     register_forward(FM_PlayerPreThink, "Hook_FM_PlayerPreThink")
43 :     register_forward(FM_PlayerPostThink, "Hook_FM_PlayerPostThink")
44 :     register_forward(FM_ClientUserInfoChanged, "Hook_ClientUserInfoChanged")
45 : ian 17
46 :     // Only register the traceline forward if there actually is a plugin
47 :     // that needs it. Otherwise this will mess with set_user_hitzones
48 : ian 1
49 : ian 17 new pluginnum = get_pluginsnum();
50 :     for (new i = 0; i < pluginnum; i++)
51 :     {
52 :     if (plugin_flags(0, i) & AMX_FLAG_OLDFILE && // plugin is an AMX plugin being emulated
53 :     get_func_id("traceline", i) != -1) // plugin needs traceline
54 :     {
55 :     register_forward(FM_TraceLine, "Hook_FM_TraceLine")
56 :     break;
57 :     }
58 :    
59 :     }
60 : ian 1 /* Global Forwards */
61 :     g_FwdTouch = CreateMultiForwardEx("entity_touch", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_CELL)
62 :     g_FwdThink = CreateMultiForwardEx("entity_think", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
63 :     g_FwdSpawn = CreateMultiForwardEx("entity_spawn", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
64 :     g_FwdClientPreThink = CreateMultiForwardEx("client_prethink", ET_IGNORE, FORWARD_ONLY_OLD, FP_CELL)
65 :     g_FwdClientPostThink = CreateMultiForwardEx("client_postthink", ET_IGNORE, FORWARD_ONLY_OLD, FP_CELL)
66 :     g_FwdEmitSound = CreateMultiForwardEx("emitsound", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
67 :     g_FwdEmitAmbientSound = CreateMultiForwardEx("emitambientsound", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
68 :     g_FwdSetModel = CreateMultiForwardEx("set_model", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING)
69 :     g_FwdTraceLine = CreateMultiForwardEx("traceline", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
70 :     g_FwdSetCliKeyValue = CreateMultiForwardEx("setclientkeyvalue", ET_STOP, FORWARD_ONLY_OLD, FP_CELL, FP_STRING, FP_STRING)
71 :     g_FwdKeyValue = CreateMultiForwardEx("keyvalue", ET_STOP, FORWARD_ONLY_OLD, FP_CELL)
72 :    
73 :     /* User Messages */
74 :     g_msgDamage = get_user_msgid("Damage")
75 :     g_msgDeathMsg = get_user_msgid("DeathMsg")
76 :     g_msgScoreInfo = get_user_msgid("ScoreInfo")
77 :     }
78 :    
79 :     VexdUM_Natives()
80 :     {
81 :     /* implicit compatibility */
82 :     register_native("is_entity", "__is_entity")
83 :     register_native("find_entity", "__find_entity")
84 :     register_native("find_entity_sphere", "__find_entity_sphere")
85 :     register_native("in_view_cone", "__in_view_cone")
86 :     register_native("get_offset_int", "__get_offset_int")
87 :     register_native("set_offset_int", "__set_offset_int")
88 :     register_native("trace_line", "__trace_line")
89 :     register_native("traceline_get_int", "__traceline_get_int")
90 :     register_native("traceline_set_int", "__traceline_set_int")
91 :     register_native("traceline_get_edict", "__traceline_get_edict")
92 :     register_native("traceline_set_edict", "__traceline_set_edict")
93 :     register_native("traceline_set_float", "__traceline_set_float")
94 :     register_native("can_see", "__can_see")
95 :     register_native("user_spawn", "__user_spawn")
96 :     register_native("get_maxentities", "__get_maxentities")
97 :     register_native("PointContents", "__PointContents")
98 :     register_native("DispatchKeyValue", "__DispatchKeyValue")
99 :     register_native("entity_use","__entity_use")
100 :     register_native("get_num_ents","__get_num_ents")
101 :     register_native("take_damage","__take_damage")
102 :    
103 :     if (g_ModType == MOD_CSTRIKE)
104 :     {
105 :     register_native("set_user_model", "__cs_set_user_model")
106 :     } else {
107 :     register_native("set_user_model", "__set_user_model")
108 :     }
109 :     }
110 :    
111 :     VexdUM_ClientConnect(id)
112 :     {
113 :     g_PlayerModels[id][0] = 0
114 :     g_PlayerModeled[id] =0
115 :     }
116 :    
117 :     SetClientKeyValue(id, const key[], const value[])
118 :     {
119 :     new buffer = engfunc(EngFunc_GetInfoKeyBuffer, id)
120 :    
121 : ian 44 return engfunc(EngFunc_SetClientKeyValue, id, buffer, key, value)
122 : ian 1 }
123 :    
124 :     GetClientKeyValue(id, const key[], value[], maxlen)
125 :     {
126 :     new buffer = engfunc(EngFunc_GetInfoKeyBuffer, id)
127 :    
128 :     engfunc(EngFunc_InfoKeyValue, buffer, key, value, maxlen)
129 :     }
130 :    
131 :     Death(victim, killer, weapon[64], hs)
132 :     {
133 :     if(pev(victim,pev_takedamage) > DAMAGE_NO)
134 :     {
135 :     new inflictor = pev(killer,pev_owner)
136 :     if(pev(killer,pev_flags) & (FL_CLIENT | FL_FAKECLIENT))
137 :     {
138 :     if(equal(weapon,""))
139 :     {
140 :     pev(killer,pev_viewmodel2,weapon,63)
141 :    
142 :     replace(weapon,63,"models/v_","")
143 :     weapon[strlen(weapon) - 4] = '^0'
144 :     }
145 :     }
146 :     else if(inflictor > 0 && inflictor < get_maxplayers())
147 :     {
148 :     if(equal(weapon,""))
149 :     {
150 :     pev(killer,pev_viewmodel2,weapon,63)
151 :    
152 :     replace(weapon,63,"weapon_","")
153 :     replace(weapon,63,"monster_","")
154 :     replace(weapon,63,"func_","")
155 :     }
156 :    
157 :     if(inflictor == victim)
158 :     {
159 :     killer = victim
160 :     } else {
161 :     killer = inflictor
162 :     }
163 :     }
164 :    
165 :     message_begin(MSG_ALL,g_msgDeathMsg)
166 :     write_byte(killer)
167 :     write_byte(victim)
168 :     write_byte(hs)
169 :     write_string(weapon)
170 :     message_end()
171 :    
172 :     new vname[32],vauthid[32],vteam[32]
173 :     get_user_name(victim,vname,31)
174 :     get_user_authid(victim,vauthid,31)
175 :     get_user_team(victim,vteam,31)
176 :    
177 :     if(victim == killer)
178 :     {
179 :     log_message("^"%s<%i><%s><%s>^" killed self with ^"%s^"^n",vname,get_user_userid(victim),
180 :     vauthid,vteam,weapon)
181 :     }
182 :     else if(pev(killer,pev_flags) & (FL_CLIENT | FL_FAKECLIENT))
183 :     {
184 :     new kname[32],kauthid[32],kteam[32],team
185 :     get_user_name(killer,kname,31)
186 :     get_user_authid(killer,kauthid,31)
187 :     team = get_user_team(killer,kteam,31)
188 :    
189 :     log_message("^"%s<%i><%s><%s>^" killed ^"%s<%i><%s><%s>^" with ^"%s^"^n",kname,get_user_userid(killer),
190 :     kauthid,kteam,vname,get_user_userid(victim),vauthid,vteam,weapon)
191 :    
192 :     new Float:frags
193 :     pev(killer,pev_frags,frags)
194 :     set_pev(killer,pev_frags,frags+1.0)
195 :    
196 :     message_begin(MSG_ALL,g_msgScoreInfo)
197 :     write_byte(killer)
198 :     write_short(floatround(frags))
199 :     write_short(get_user_deaths(killer))
200 :     write_short(0)
201 :     write_short(team)
202 :     message_end()
203 :    
204 :     pev(victim,pev_frags,frags)
205 :     set_pev(victim,pev_frags,frags+1.0)
206 :     } else {
207 :     log_message("^"%s<%i><%s><%s>^" killed by ^"%s^"^n",vname,get_user_userid(victim),vauthid,vteam,weapon)
208 :     }
209 :    
210 :     set_msg_block(g_msgDeathMsg,BLOCK_ONCE)
211 :     dllfunc(DLLFunc_ClientKill,victim)
212 :     }
213 :     }
214 :    
215 :     public __is_entity(plid, num)
216 :     {
217 :     new ent = get_param(1)
218 :     return is_entity(ent)
219 :     }
220 :    
221 :     public __find_entity(plid, num)
222 :     {
223 :     static entstr[256]
224 :     new startEnt, type
225 :    
226 :     startEnt = get_param(1)
227 :     get_string(2, entstr, 255)
228 :     type = get_param(3)
229 :    
230 :     return find_entity(startEnt, entstr, type)
231 :     }
232 :    
233 :     public __find_entity_sphere(plid, num)
234 :     {
235 :     new ent
236 :     new Float:orig[3]
237 :     new Float:radius
238 :    
239 :     ent = get_param(1)
240 :     get_array_f(2, orig, 3)
241 :     radius = get_param_f(3)
242 :    
243 :     return find_entity_sphere(ent, orig, radius)
244 :     }
245 :    
246 :     public __in_view_cone(plid, num)
247 :     {
248 :     new ent
249 :     new Float:orig[3]
250 :    
251 :     ent = get_param(1)
252 :     get_array_f(2, orig, 3)
253 :    
254 :     return in_view_cone(ent, orig)
255 :     }
256 :    
257 :     public __get_offset_int(plid, num)
258 :     {
259 :     new ent = get_param(1)
260 :     new offs = get_param(2)
261 :     new linux = get_param(3)
262 :    
263 :     return get_pdata_int(ent, offs, linux)
264 :     }
265 :    
266 :     public __set_offset_int(plid, num)
267 :     {
268 :     return set_offset_int(get_param(1), get_param(2), get_param(3), get_param(4))
269 :     }
270 :    
271 :     public __trace_line(plid, num)
272 :     {
273 :     new ent = get_param(1)
274 :    
275 :     new Float:vStart[3], Float:vEnd[3], Float:vReturn[3]
276 :    
277 :     get_array_f(2, vStart, 3)
278 :     get_array_f(3, vEnd, 3)
279 :    
280 :     if (ent == FM_NULLENT)
281 :     engfunc(EngFunc_TraceLine, vStart, vEnd, IGNORE_MONSTERS, 0, 0)
282 :     else
283 :     engfunc(EngFunc_TraceLine, vStart, vEnd, DONT_IGNORE_MONSTERS, ent, 0)
284 :    
285 :     get_tr2(0, TraceResult:TR_vecEndPos, vReturn)
286 :    
287 :     set_array_f(4, vReturn, 3)
288 :    
289 :     new traceHit = get_tr2(0, TraceResult:TR_pHit)
290 :    
291 :     if (!pev_valid(traceHit))
292 :     return FM_NULLENT
293 :    
294 :     return traceHit
295 :     }
296 :    
297 :     public __traceline_get_int(plid, num)
298 :     {
299 :     new iSet = get_param(1)
300 :     new iValue = 0
301 :    
302 :     switch (iSet)
303 :     {
304 :     case TR_INT_fAllSolid:
305 :     iValue = get_tr2(g_LastTrace, TraceResult:TR_AllSolid)
306 :     case TR_INT_fStartSolid:
307 :     iValue = get_tr2(g_LastTrace, TraceResult:TR_StartSolid)
308 :     case TR_INT_fInOpen:
309 :     iValue = get_tr2(g_LastTrace, TraceResult:TR_InOpen)
310 :     case TR_INT_fInWater:
311 :     iValue = get_tr2(g_LastTrace, TraceResult:TR_InWater)
312 :     case TR_INT_iHitgroup:
313 :     iValue = get_tr2(g_LastTrace, TraceResult:TR_iHitgroup)
314 :     default:
315 :     log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
316 :     }
317 :    
318 :     return iValue
319 :     }
320 :    
321 :     public __traceline_set_int(plid, num)
322 :     {
323 :     new iSet = get_param(1)
324 :     new iValue = get_param(2)
325 :    
326 :     switch (iSet)
327 :     {
328 :     case TR_INT_fAllSolid:
329 :     set_tr2(g_LastTrace, TraceResult:TR_AllSolid, iValue)
330 :     case TR_INT_fStartSolid:
331 :     set_tr2(g_LastTrace, TraceResult:TR_StartSolid, iValue)
332 :     case TR_INT_fInOpen:
333 :     set_tr2(g_LastTrace, TraceResult:TR_InOpen, iValue)
334 :     case TR_INT_fInWater:
335 :     set_tr2(g_LastTrace, TraceResult:TR_InWater, iValue)
336 :     case TR_INT_iHitgroup:
337 :     set_tr2(g_LastTrace, TraceResult:TR_iHitgroup, iValue)
338 :     default:
339 :     {
340 :     log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
341 :     return 0
342 :     }
343 :     }
344 :    
345 :     return 1
346 :     }
347 :    
348 :     public __traceline_get_edict(plid, num)
349 :     {
350 :     new iSet = get_param(1)
351 :     new iValue = 0
352 :    
353 :     switch (iSet)
354 :     {
355 :     case TR_ENT_pHit:
356 :     iValue = get_tr2(g_LastTrace, TraceResult:TR_pHit)
357 :     default:
358 :     log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
359 :     }
360 :    
361 :     return iValue
362 :     }
363 :    
364 :     public __traceline_set_edict(plid, num)
365 :     {
366 :     new iSet = get_param(1)
367 :     new iValue = get_param(2)
368 :    
369 :     switch (iSet)
370 :     {
371 :     case TR_ENT_pHit:
372 :     set_tr2(g_LastTrace, TraceResult:TR_pHit, iValue)
373 :     default:
374 :     {
375 :     log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
376 :     return 0
377 :     }
378 :     }
379 :    
380 :     return 1
381 :     }
382 :    
383 :     public Float:__traceline_get_float(plid, num)
384 :     {
385 :     new iSet = get_param(1)
386 :     new Float:fValue = 0.0
387 :    
388 :     switch (iSet)
389 :     {
390 :     case TR_FL_flFraction:
391 :     get_tr2(g_LastTrace, TraceResult:TR_flFraction, fValue)
392 :     case TR_FL_flPlaneDist:
393 :     get_tr2(g_LastTrace, TraceResult:TR_flPlaneDist, fValue)
394 :     default:
395 :     log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
396 :     }
397 :    
398 :     return fValue
399 :     }
400 :    
401 :     public __traceline_set_float(plid, num)
402 :     {
403 :     new iSet = get_param(1)
404 :     new Float:fValue = get_param_f(2)
405 :    
406 :     switch (iSet)
407 :     {
408 :     case TR_FL_flFraction:
409 :     set_tr2(g_LastTrace, TraceResult:TR_flFraction, fValue)
410 :     case TR_FL_flPlaneDist:
411 : ian 17 set_tr2(g_LastTrace, TraceResult:TR_flPlaneDist, fValue)
412 : ian 1 default:
413 :     {
414 :     log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
415 :     return 0
416 :     }
417 :     }
418 :    
419 :     return 1
420 :     }
421 :    
422 :     public __traceline_get_vector(plid, num)
423 :     {
424 :     new iSet = get_param(1)
425 :     new Float:vValue[3]
426 :    
427 :     switch (iSet)
428 :     {
429 :     case TR_VEC_vecEndPos:
430 :     get_tr2(g_LastTrace, TraceResult:TR_vecEndPos, vValue)
431 :     case TR_VEC_vecPlaneNormal:
432 :     get_tr2(g_LastTrace, TraceResult:TR_vecPlaneNormal, vValue)
433 :     default:
434 :     {
435 :     log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
436 :     return 0
437 :     }
438 :     }
439 :    
440 :     set_array_f(2, vValue, 3)
441 :    
442 :     return 1
443 :     }
444 :    
445 :     public __traceline_set_vector(plid, num)
446 :     {
447 :     new iSet = get_param(1)
448 :     new Float:vValue[3]
449 :    
450 :     get_array_f(2, vValue, 3)
451 :    
452 :     switch (iSet)
453 :     {
454 :     case TR_VEC_vecEndPos:
455 :     set_tr2(g_LastTrace, TraceResult:TR_vecEndPos, vValue)
456 :     case TR_VEC_vecPlaneNormal:
457 :     set_tr2(g_LastTrace, TraceResult:TR_vecPlaneNormal, vValue)
458 :     default:
459 :     {
460 :     log_error(AMX_ERR_NATIVE, "Invalid TR_ parameter")
461 :     return 0
462 :     }
463 :     }
464 :    
465 :     return 1
466 :     }
467 :    
468 :     public __can_see(plid, num)
469 :     {
470 :     return can_see(get_param(1), get_param(2))
471 :     }
472 :    
473 :     public __user_spawn(plid, num)
474 :     {
475 :     return dllfunc(DLLFunc_Spawn, get_param(1))
476 :     }
477 :    
478 :     public __set_user_model(plid, num)
479 :     {
480 :     new id = get_param(1)
481 :     if (id < 1 || id > g_MaxPlayers)
482 :     {
483 :     return 0
484 :     }
485 :    
486 :     new model[64]
487 :     get_string(2, model, 63)
488 :     if (model[0] == 0)
489 :     {
490 :     if (!g_PlayerModeled[id])
491 :     {
492 :     return 0
493 :     }
494 :     g_PlayerModeled[id] = 0
495 :     g_PlayerModels[id][0] = 0
496 :     dllfunc(DLLFunc_ClientUserInfoChanged, id)
497 :     } else {
498 :     copy(g_PlayerModels[id], 63, model)
499 :     g_PlayerModeled[id] = 1
500 :     SetClientKeyValue(id, "model", model)
501 :     }
502 :    
503 :     return 1
504 :     }
505 :    
506 :     public __cs_set_user_model(plid, num)
507 :     {
508 :     new id = get_param(1)
509 :     new model[64]
510 :    
511 :     get_string(2, model, 63)
512 :    
513 :     return cs_set_user_model(id, model)
514 :     }
515 :    
516 :     public __get_maxentities(plid, num)
517 :     {
518 :     return get_maxentities()
519 :     }
520 :    
521 :     public __PointContents(plid, num)
522 :     {
523 :     new Float:vCheckAt[3]
524 :    
525 :     get_array_f(1, vCheckAt, 3)
526 :    
527 :     return point_contents(vCheckAt)
528 :     }
529 :    
530 :     public __DispatchKeyValue(plid, num)
531 :     {
532 :     new ent = get_param(1)
533 :    
534 :     new szClassname[32], szKey[32], szValue[32]
535 :    
536 :     if (pev_valid(ent))
537 :     {
538 :     get_string(2, szKey, 31)
539 :     get_string(3, szValue, 31)
540 :     pev(ent, pev_classname, szClassname, 31)
541 :    
542 :     set_kvd(0, KV_ClassName, szClassname)
543 :     set_kvd(0, KV_KeyName, szKey)
544 :     set_kvd(0, KV_Value, szValue)
545 :     set_kvd(0, KV_fHandled, 0)
546 :    
547 :     dllfunc(DLLFunc_KeyValue, ent, 0)
548 :     }
549 :    
550 :     return 1
551 :     }
552 :    
553 :     public __entity_use(plid, num)
554 :     {
555 :     new entUsed = get_param(1)
556 :     new entOther = get_param(2)
557 :     return dllfunc(DLLFunc_Use,entUsed,entOther)
558 :     }
559 :    
560 :     public __get_num_ents(plid, num)
561 :     {
562 :     return engfunc(EngFunc_NumberOfEntities)
563 :     }
564 :    
565 :     public __take_damage(plid, num)
566 :     {
567 :     new victim = get_param(1)
568 :     new attacker = get_param(2)
569 :     new Float:orig[3]
570 :     get_array_f(3,orig,3)
571 :     new Float:dmg = get_param_f(4)
572 :     new bit = get_param(5)
573 :     new wpnName[64]
574 :     get_string(6,wpnName,63)
575 :     new hs = get_param(7)
576 :    
577 :     if(pev(victim,pev_takedamage) > DAMAGE_NO)
578 :     {
579 :     set_pev(victim,pev_dmg_inflictor,attacker)
580 :    
581 :     new Float:olddmg
582 :     pev(victim,pev_dmg_take,olddmg)
583 :     set_pev(victim,pev_dmg_take,olddmg+dmg)
584 :    
585 :     message_begin(MSG_ONE, g_msgDamage, {0,0,0} , victim)
586 :     write_byte(0)
587 :     write_byte(floatround(olddmg+dmg))
588 :     write_long(bit)
589 :     write_coord(floatround(orig[0]))
590 :     write_coord(floatround(orig[1]))
591 :     write_coord(floatround(orig[2]))
592 :     message_end()
593 :    
594 :     new Float:health
595 :     pev(victim,pev_health,health)
596 :     if((dmg >= health) && (health > 0.0))
597 :     {
598 :     Death(victim,attacker,wpnName,hs)
599 :     } else {
600 :     set_pev(victim,pev_health,health-dmg)
601 :     }
602 :     }
603 :     }
604 :    
605 :     /*********************************
606 :     ***** HOOKS *********************
607 :     *********************************/
608 :    
609 :     public Hook_ClientUserInfoChanged(id, buffer)
610 :     {
611 :     if (g_PlayerModeled[id] && (pev(id, pev_deadflag) == DEAD_NO))
612 :     {
613 :     return FMRES_SUPERCEDE
614 :     }
615 :    
616 :     return FMRES_IGNORED
617 :     }
618 :    
619 :     public Hook_FM_EmitSound(entid, channel, const sample[]) //we don't care about the rest
620 :     {
621 :     new ret
622 :    
623 :     ExecuteForward(g_FwdEmitSound, ret, entid, sample)
624 :    
625 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
626 :     }
627 :    
628 :     public Hook_FM_EmitAmbientSound(entid, Float:pos[3], const sample[]) //we don't care about the rest
629 :     {
630 :     new ret
631 :    
632 :     ExecuteForward(g_FwdEmitAmbientSound, ret, entid, sample)
633 :    
634 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
635 :     }
636 :    
637 :     public Hook_FM_SetModel(entid, const model[])
638 :     {
639 :     new ret
640 :    
641 :     ExecuteForward(g_FwdSetModel, ret, entid, model)
642 :    
643 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
644 :     }
645 :    
646 :     public Hook_FM_TraceLine(Float:v1[3], Float:v2[3], noMonsters, skip_ent, ptr)
647 :     {
648 :     g_LastTrace = ptr
649 :    
650 :     engfunc(EngFunc_TraceLine, v1, v2, noMonsters, skip_ent, ptr)
651 :    
652 :     new ret
653 :    
654 :     ExecuteForward(g_FwdTraceLine, ret, skip_ent)
655 :    
656 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
657 :     }
658 :    
659 :     public Hook_FM_SetClientKeyValue(id, const infobuffer[], const key[], const value[])
660 :     {
661 :     new ret
662 :    
663 :     ExecuteForward(g_FwdSetCliKeyValue, ret, id, key, value)
664 :    
665 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
666 :     }
667 :    
668 :     public Hook_FM_KeyValue(ent, kvd)
669 :     {
670 :     new ret
671 :    
672 :     ExecuteForward(g_FwdKeyValue, ret, ent)
673 :    
674 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
675 :     }
676 :    
677 :     public Hook_FM_Touch(ent1, ent2)
678 :     {
679 :     new ret
680 :    
681 :     ExecuteForward(g_FwdTouch, ret, ent1, ent2)
682 :    
683 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
684 :     }
685 :    
686 :     public Hook_FM_Think(entid)
687 :     {
688 :     new ret
689 :    
690 :     ExecuteForward(g_FwdThink, ret, entid)
691 :    
692 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
693 :     }
694 :    
695 :     public Hook_FM_Spawn(entid)
696 :     {
697 :     new ret
698 :    
699 :     ExecuteForward(g_FwdSpawn, ret, entid)
700 :    
701 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
702 :     }
703 :    
704 :     public Hook_FM_PlayerPreThink(id)
705 :     {
706 :     new ret
707 :    
708 :     ExecuteForward(g_FwdClientPreThink, ret, id)
709 :    
710 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
711 :     }
712 :    
713 :     public Hook_FM_PlayerPostThink(id)
714 :     {
715 :     new ret
716 :    
717 :     if (g_PlayerModeled[id])
718 :     {
719 :     new model[64]
720 :     GetClientKeyValue(id, "model", model, 63)
721 :     if (!equal(g_PlayerModels[id], model))
722 :     {
723 :     SetClientKeyValue(id, "model", g_PlayerModels[id])
724 :     }
725 :     }
726 :    
727 :     ExecuteForward(g_FwdClientPostThink, ret, id)
728 :    
729 :     return (ret == PLUGIN_HANDLED) ? FMRES_SUPERCEDE : FMRES_IGNORED
730 :     }

Contact
ViewVC Help
Powered by ViewVC 1.0.4