Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2015
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.06 KB | None | 0 0
  1. /*
  2. gay copey pastey cheat v8
  3.  
  4. credz:
  5. ph0ne
  6. fr1kin
  7. noPE
  8. */
  9. if( !CLIENT ) then
  10. return end
  11.  
  12. if( NYX ) then
  13. _G['NYX'] = nil;
  14. end
  15.  
  16. require( "nyx" );
  17.  
  18. _nyx['Init']();
  19.  
  20. local NYX = {};
  21. NYX['keys'] = {};
  22. NYX['detours'] = {};
  23. NYX['hooks'] = {};
  24. NYX['coners'] = {}; // heh boners
  25. NYX['distance'] = 9999999999;
  26. NYX['target'] = nil;
  27. NYX['aimpos'] = Angle( 0, 0, 0 );
  28. NYX['aiming'] = false;
  29. NYX['speeding'] = false;
  30. NYX['admins'] = false;
  31. NYX['testing'] = false;
  32.  
  33. function NYX:BindKey( key, _var, _mouse )
  34. NYX['keys'][key] = { var = _var, mouse = _mouse };
  35. end
  36.  
  37. NYX:BindKey( MOUSE_MIDDLE, 'admins', true );
  38. NYX:BindKey( KEY_LALT, 'speeding', false );
  39. NYX:BindKey( KEY_CAPSLOCK, 'aiming', false );
  40. NYX:BindKey( KEY_F, 'testing', false ); // something i use when working on shit
  41.  
  42. surface['CreateFont']( "fonty", { font = "Lucida Console", size = 12, antialias = false } );
  43.  
  44. function NYX:IsAdmin( v )
  45. if( v:IsAdmin()
  46. || v:IsSuperAdmin()
  47. || v:IsUserGroup( "Admin" )
  48. || v:IsUserGroup( "admin" )
  49. || v:IsUserGroup( "Owner" )
  50. || v:IsUserGroup( "owner" )
  51. || v:IsUserGroup( "SuperAdmin" )
  52. || v:IsUserGroup( "superadmin" )
  53. || v:IsUserGroup( "Operator" )
  54. || v:IsUserGroup( "operator" )
  55. || v:IsUserGroup( "Moderator" )
  56. || v:IsUserGroup( "moderator" ) ) then
  57. return true;
  58. end
  59.  
  60. return false;
  61. end
  62.  
  63. function NYX.Draw()
  64. local listpos = ScrH() / 3.5;
  65.  
  66. for k, v in pairs( ents['GetAll']() ) do
  67. if( v:IsPlayer() ) then
  68. if( v:Alive() && v:Team() != TEAM_SPECTATOR && v != LocalPlayer() && !_nyx['IsDormant']( v:EntIndex() ) ) then
  69. local col = ( v == NYX['target'] ) && Color( 255, 255, 255, 255 ) || Color( 10, 130, 255, 255 );
  70.  
  71. if( v:GetFriendStatus() == "friend" ) then
  72. col = Color( 100, 255, 0, 255 );
  73. end
  74.  
  75. local bot = ( v:GetPos() + Vector( 0, 0, 20 ) ):ToScreen();
  76. local top = ( v:GetPos() + Vector( 0, 0, 50 ) ):ToScreen();
  77. local height = ( bot['y'] - top['y'] );
  78. local width = ( height / 2 );
  79. surface['SetDrawColor']( col );
  80. surface['DrawOutlinedRect']( top['x'] - width, top['y'], width * 2, height );
  81.  
  82. surface['SetDrawColor']( 0, 0, 0, 255 );
  83. surface['DrawOutlinedRect']( top['x'] - width - 1, top['y'] - 1, width * 2 + 2, height + 2 );
  84. surface['DrawOutlinedRect']( top['x'] - width + 1, top['y'] + 1, width * 2 - 2, height - 2 );
  85.  
  86. draw['SimpleTextOutlined']( v:Nick(), "fonty", top['x'], top['y'] - 8, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 0, 0, 0, 255 ) );
  87. end
  88.  
  89. if( !NYX['admins'] ) then
  90. if( v:GetObserverTarget() == LocalPlayer() ) then
  91. local col = ( NYX:IsAdmin( v ) ) && Color( 255, 80, 80, 255 ) || Color( 255, 255, 255, 255 );
  92. draw['SimpleTextOutlined']( v:Nick(), "fonty", 2, listpos, col, TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color( 0, 0, 0, 255 ) );
  93.  
  94. listpos = listpos + 12;
  95. end
  96. else
  97. if( NYX:IsAdmin( v ) ) then
  98. draw['SimpleTextOutlined']( v:Nick(), "fonty", 2, listpos, Color( 255, 80, 80, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_LEFT, 1, Color( 0, 0, 0, 255 ) );
  99.  
  100. listpos = listpos + 12;
  101. end
  102. end
  103. else
  104. if( v['CanBuy'] ) then
  105. local pos = v:GetPos():ToScreen();
  106. local col;
  107.  
  108. if( table['HasValue']( v['CanBuy'], ROLE_TRAITOR ) ) then
  109. col = Color( 255, 80, 80, 255 );
  110. else
  111. col = Color( 0, 100, 255, 255 );
  112. end
  113.  
  114. local class = string['gsub']( v:GetClass(), "weapon_ttt_", "" );
  115. draw['SimpleTextOutlined']( class, "fonty", pos['x'], pos['y'], col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, 1, Color( 0, 0, 0, 255 ) );
  116. end
  117. end
  118. end
  119. end
  120.  
  121. NYX['attachments'] =
  122. {
  123. "eyes",
  124. "forward",
  125. "head",
  126. };
  127.  
  128. function NYX:GetAimPos( e )
  129. for k, v in pairs( NYX['attachments'] ) do
  130. if( e:LookupAttachment( v ) ) then
  131. local att = e:GetAttachment( e:LookupAttachment( v ) );
  132. if( att ) then
  133. return att['Pos'];
  134. end
  135. end
  136. end
  137.  
  138. return ( e:LocalToWorld( e:OBBCenter() ) );
  139. end
  140.  
  141. function NYX:IsVisible( v )
  142. local tracedata =
  143. {
  144. start = LocalPlayer():GetShootPos(),
  145. endpos = NYX:GetAimPos( v ),
  146. filter = { LocalPlayer(), v },
  147. mask = MASK_SHOT
  148. };
  149.  
  150. local trace = util['TraceLine']( tracedata );
  151.  
  152. return ( trace['Fraction'] == 1 );
  153. end
  154.  
  155. function NYX:ValidTarget( v )
  156. if( _nyx['IsDormant']( v:EntIndex() ) ) then
  157. return false;
  158. end
  159.  
  160. if( !v:Alive() ) then
  161. return false;
  162. end
  163.  
  164. if( v:Team() == TEAM_SPECTATOR ) then
  165. return false;
  166. end
  167.  
  168. if( v == LocalPlayer() ) then
  169. return false;
  170. end
  171.  
  172. if( v:GetFriendStatus() == "friend" ) then
  173. return false;
  174. end
  175.  
  176. if( string['find']( string['lower']( GAMEMODE['Name'] ), "trouble in terror" ) ) then
  177. if( v:IsTraitor() ) then
  178. return false;
  179. end
  180. end
  181.  
  182. local col = v:GetColor();
  183.  
  184. if( string['find']( string['lower']( GAMEMODE['Name'] ), "stronghold" ) ) then
  185. if( col['a'] < 255 ) then
  186. return false;
  187. end
  188. end
  189.  
  190. if( !NYX:IsVisible( v ) ) then
  191. return false;
  192. end
  193.  
  194. return true;
  195. end
  196.  
  197. function NYX:FindTarget()
  198. // reset aim data before looping through players
  199. NYX['target'] = nil;
  200. NYX['distance'] = 9999999;
  201.  
  202. if( !NYX['aiming'] ) then
  203. return end
  204.  
  205. for k, v in pairs( player['GetAll']() ) do
  206. if( NYX:ValidTarget( v ) ) then
  207. local distance = math['deg']( math['acos']( LocalPlayer():GetAimVector():Dot( ( NYX:GetAimPos( v ) - LocalPlayer():GetShootPos() ):GetNormal() ) ) );
  208. if( distance < NYX['distance'] ) then
  209. NYX['target'] = v;
  210. NYX['distance'] = distance;
  211. local pred;
  212.  
  213. if( !NYX['testing'] ) then
  214. pred = ( ( v:GetVelocity() / 50 - LocalPlayer():GetVelocity() / 50 ) - Vector( 0, 0, 0 ) );
  215. else
  216. pred = ( v:GetVelocity() * v:GetPos():Distance( LocalPlayer():GetPos() ) / 3110 );
  217. end
  218.  
  219. local pos = NYX:GetAimPos( v )
  220.  
  221. NYX['aimpos'] = ( ( pos + pred ) - LocalPlayer():EyePos() ):Angle();
  222.  
  223. NYX['aimpos']['p'] = math['NormalizeAngle']( NYX['aimpos']['p'] );
  224. NYX['aimpos']['y'] = math['NormalizeAngle']( NYX['aimpos']['y'] );
  225. NYX['aimpos']['r'] = 0;
  226. end
  227. end
  228. end
  229. end
  230.  
  231. function NYX:KeyEvent()
  232. for k, v in pairs( NYX['keys'] ) do
  233. if( v['mouse'] ) then
  234. if( input['IsMouseDown']( k ) ) then
  235. NYX[v['var']] = true;
  236. else
  237. NYX[v['var']] = false;
  238. end
  239. else
  240. if( input['IsKeyDown']( k ) ) then
  241. NYX[v['var']] = true;
  242. else
  243. NYX[v['var']] = false;
  244. end
  245. end
  246.  
  247. end
  248. end
  249.  
  250. function NYX.Think()
  251. NYX:FindTarget();
  252. NYX:KeyEvent();
  253. end
  254.  
  255. function NYX.CalcView( ply, origin, angles, fov )
  256. local view = GAMEMODE:CalcView( ply, origin, angles, fov ) || {};
  257. // i'll do something with this later
  258. return view;
  259. end
  260.  
  261. function NYX:Detour( old, new )
  262. NYX['detours'][new] = old;
  263. return new;
  264. end
  265.  
  266. local _R = debug['getregistry'](); // sdfsdfsdfsd
  267.  
  268. _R['Entity']['FireBullets'] = NYX:Detour( _R['Entity']['FireBullets'], function( ent, bullet )
  269. NYX['coners'][LocalPlayer():GetActiveWeapon():GetPrintName()] = bullet['Spread'];
  270. return NYX['detours'][_R['Entity']['FireBullets']]( ent, bullet );
  271. end )
  272.  
  273. //_G['hook']['Call'] = NYX:Detour( _G['hook']['Call'], function( name, gm, ... )
  274. // MsgN( name );
  275. // return NYX['detours'][_G['hook']['Call']]( name, gm, ... );
  276. //end )
  277.  
  278. NYX['cones'] =
  279. {
  280. ["#HL2_SMG1"] = Vector( -0.04362, -0.04362, -0.04362 ),
  281. ["#HL2_Pistol"] = Vector( -0.0100, -0.0100, -0.0100 ),
  282. ["#HL2_Pulse_Rifle"] = Vector( -0.02618, -0.02618, -0.02618 ),
  283. ["#HL2_Shotgun"] = Vector( -0.08716, -0.08716, -0.08716 ),
  284. };
  285.  
  286. function NYX:NoSpread( cmd, ang )
  287. wep = LocalPlayer():GetActiveWeapon();
  288. vecCone, valCone = Vector( 0, 0, 0 );
  289.  
  290. if( wep:IsValid() ) then
  291. if( NYX['coners'][wep:GetPrintName()] ) then
  292. valCone = NYX['coners'][wep:GetPrintName()];
  293. if( tonumber( valCone ) ) then
  294. vecCone = Vector( -valCone, -valCone, -valCone );
  295. elseif( type( valCone ) == "Vector" ) then
  296. vecCone = -1 * valCone;
  297. end
  298. else
  299. if( NYX['cones'][wep:GetPrintName()] ) then
  300. vecCone = NYX['cones'][wep:GetPrintName()];
  301. end
  302. end
  303. end
  304.  
  305. return ( _nyx['RemoveSpread']( cmd, ang, vecCone ) ):Angle();
  306. end
  307.  
  308. function NYX.CreateMove( cmd )
  309. if( NYX['aiming'] && NYX['target'] ) then
  310. local ang = NYX:NoSpread( cmd, NYX['aimpos'] )
  311.  
  312. ang['p'] = math['NormalizeAngle']( ang['p'] );
  313. ang['y'] = math['NormalizeAngle']( ang['y'] );
  314. ang['r'] = 0;
  315.  
  316. _nyx['SetViewAngles']( cmd, ang );
  317.  
  318. cmd:SetButtons( bit['bor']( cmd:GetButtons(), IN_ATTACK ) );
  319. end
  320.  
  321. _nyx['Bunnyhop']( cmd, LocalPlayer():IsOnGround(), LocalPlayer():GetMoveType() );
  322.  
  323. _nyx['Speedhack']( NYX['speeding'] );
  324. end
  325.  
  326. // detouring hook.Call/Run wasn't working for all hooks so i'm settling for this
  327. function NYX:AddHook( name, callback )
  328. local gay = tostring( math['random']( 0.666, 666 ) * math['random']( 0.666, 666 ) ); // 666 hail satan my parents dont understand me fuck the system
  329. hook['Add']( name, gay, callback );
  330. end
  331.  
  332. NYX:AddHook( "DrawOverlay", NYX['Draw'] );
  333. NYX:AddHook( "Think", NYX['Think'] );
  334. NYX:AddHook( "CalcView", NYX['CalcView'] );
  335. NYX:AddHook( "CreateMove", NYX['CreateMove'] );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement