Raised This Month: $ Target: $400
 0% 

Help with some phy emulation


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Nightfall1
Senior Member
Join Date: Aug 2008
Old 05-06-2011 , 16:18   Help with some phy emulation
Reply With Quote #1

PHP Code:
new const classes[][] = { "weaponbox""item_thighpack""weapon_shield""grenade"}
 
public 
plugin_init()
{
 for (new 
xsizeof classesx++)
  
RegisterHam(Ham_Touchclasses[x], "touch_test")
}
 
public 
touch_test(enttouched)
{
 new 
owner pev(entpev_owner)
 if (!
pev_valid(ent)) return HAM_IGNORED
 
if ((touched != owner) && (touched <= 33 && touched != 0))
 {
  
set_pev(entpev_ownertouched)
  if(
pev(entpev_flags) & FL_ONGROUND)
  {
   
set_pev(entpev_owner0)
   return 
HAM_IGNORED
  
}
 
  static 
Float:oent[3], Float:otou[3], Float:oaim[3], velnew
  pev
(entpev_originoent)
  
pev(entpev_originotou)
  
fm_get_aim_origin(entoaim)
  if(
oaim[1] == otou[1] && oaim[2] == otou[2])
   
velnew random_num(-150, -50)
  else
   
velnew random_num(50150)
 
  
pev(entpev_velocityset_peventpev_velocityvel_by_aimownervelnew ) ))
 }
}
 
stock Float:vel_by_aimidspeed )
{
 new 
Float:v1[3], Float:vBlah[3]
 
pevidpev_anglev1 )
 
engfuncEngFunc_AngleVectorsv1v1vBlahvBlah )
 
 
v1[0] *= speed
 v1
[1] *= speed
 v1
[2] *= speed
 
 
return v1
}
 
// ported from AMXX's core get_user_origin(..., 3) (suggested by Greenberet)
stock fm_get_aim_origin(indexFloat:origin[3]) {
 new 
Float:start[3], Float:view_ofs[3];
 
pev(indexpev_originstart);
 
pev(indexpev_view_ofsview_ofs);
 
xs_vec_add(startview_ofsstart);
 
 new 
Float:dest[3];
 
pev(indexpev_v_angledest);
 
engfunc(EngFunc_MakeVectorsdest);
 
global_get(glb_v_forwarddest);
 
xs_vec_mul_scalar(dest9999.0dest);
 
xs_vec_add(startdestdest);
 
 
engfunc(EngFunc_TraceLinestartdest0index0);
 
get_tr2(0TR_vecEndPosorigin);
 
 return 
1;

Explication: drop weapon will reflect/return from him to look down \/




.gif at attackment





who I can do to look more realistic because my velocity by aim is not quite well
__________________
SIGNATURE

Last edited by Nightfall1; 05-07-2011 at 12:07.
Nightfall1 is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:30.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode