Advertisement
Guest User

NEW ONE (AFTER FIX)

a guest
Feb 22nd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.07 KB | None | 0 0
  1.  
  2. public OnGameFrame()
  3. {
  4. for(new client=1;client<=MaxClients;client++)
  5. {
  6. if(ValidPlayer(client,true))//&&!bIgnoreTrackGF[client])
  7. {
  8. new Float:currentmaxspeed=GetEntDataFloat(client,m_OffsetSpeed);
  9. //DP("speed %f, speedbefore %f , we set %f",currentmaxspeed,speedBefore[client],speedWeSet[client]);
  10. if(currentmaxspeed!=speedWeSet[client]) ///SO DID engien set a new speed? copy that!! //TFIsDefaultMaxSpeed(client,currentmaxspeed)){ //ONLY IF NOT SET YET
  11. {
  12. //DP("detected newspeed %f was %f",currentmaxspeed,speedWeSet[client]);
  13. speedBefore[client]=currentmaxspeed;
  14. reapplyspeed[client]++;
  15. }
  16. //PrintToChat(client,"speed %f %s",currentmaxspeed, TFIsDefaultMaxSpeed(client,currentmaxspeed)?"T":"F");
  17. if(reapplyspeed[client]>0)
  18. {
  19. // DP("reapply");
  20. reapplyspeed[client]=0;
  21. ///player frame tracking, if client speed is not what we set, we reapply speed
  22. //PrintToChatAll("1");
  23. if(War3_GetGame()==Game_TF)
  24. {
  25. // if(true|| speedBefore[client]>3.0){ //reapply speed, using previous cached base speed, make sure the cache isnt' zero lol
  26. new Float:speedmulti=1.0;
  27. //DP("before");
  28. //new Float:speedadd=1.0;
  29. if(!W3GetBuffHasTrue(client,bBuffDenyAll))
  30. {
  31. speedmulti=W3GetBuffMaxFloat(client,fMaxSpeed)+W3GetBuffMaxFloat(client,fMaxSpeed2)-1.0;
  32. }
  33. if(W3GetBuffHasTrue(client,bStunned)||W3GetBuffHasTrue(client,bBashed))
  34. {
  35. //DP("stunned or bashed");
  36. speedmulti=0.0;
  37. }
  38. if(!W3GetBuffHasTrue(client,bSlowImmunity))
  39. {
  40. speedmulti=FloatMul(speedmulti,W3GetBuffStackedFloat(client,fSlow));
  41. speedmulti=FloatMul(speedmulti,W3GetBuffStackedFloat(client,fSlow2));
  42. }
  43. //PrintToConsole(client,"speedmulti should be 1.0 %f %f",speedmulti,speedadd);
  44. gspeedmulti[client]=speedmulti;
  45. new Float:newmaxspeed=FloatMul(speedBefore[client],speedmulti);
  46. if(newmaxspeed<0.1)
  47. {
  48. newmaxspeed=0.1;
  49. }
  50. speedWeSet[client]=newmaxspeed;
  51. SetEntDataFloat(client,m_OffsetSpeed,newmaxspeed,true);
  52. //DP("%f",newmaxspeed);
  53. // }
  54. }
  55. else
  56. { //cs?
  57. new Float:speedmulti=1.0;
  58. //new Float:speedadd=1.0;
  59. if(!W3GetBuffHasTrue(client,bBuffDenyAll))
  60. {
  61. speedmulti=W3GetBuffMaxFloat(client,fMaxSpeed)+W3GetBuffMaxFloat(client,fMaxSpeed2)-1.0;
  62. }
  63. if(W3GetBuffHasTrue(client,bStunned)||W3GetBuffHasTrue(client,bBashed))
  64. {
  65. speedmulti=0.0;
  66. }
  67. if(!W3GetBuffHasTrue(client,bSlowImmunity))
  68. {
  69. speedmulti=FloatMul(speedmulti,W3GetBuffStackedFloat(client,fSlow));
  70. speedmulti=FloatMul(speedmulti,W3GetBuffStackedFloat(client,fSlow2));
  71. }
  72. if(GetEntDataFloat(client,m_OffsetSpeed)!=speedmulti)
  73. {
  74. SetEntDataFloat(client,m_OffsetSpeed,speedmulti);
  75. }
  76. }
  77. }
  78. new MoveType:currentmovetype=GetEntityMoveType(client);
  79. new MoveType:shouldmoveas=MOVETYPE_WALK;
  80.  
  81. if(W3GetBuffHasTrue(client,bNoClipMode))
  82. {
  83. shouldmoveas=MOVETYPE_NOCLIP;
  84. }
  85. if(W3GetBuffHasTrue(client,bFlyMode)&&!W3GetBuffHasTrue(client,bFlyModeDeny))
  86. {
  87. shouldmoveas=MOVETYPE_FLY;
  88. }
  89. if(W3GetBuffHasTrue(client,bNoMoveMode))
  90. {
  91. shouldmoveas=MOVETYPE_NONE;
  92. }
  93.  
  94. /* Glider (290611):
  95. * I have implemented a extremly dirty way to prevent some
  96. * shit that goes wrong in L4D2.
  97. *
  98. * If a tank tries to climb a object, he changes his
  99. * move type. This code prevented them from ever
  100. * climbing anything.
  101. *
  102. * Players also change their move type when they get
  103. * hit so hard they stagger into a direction, making
  104. * them move slower. This code made them stagger much
  105. * faster, resulting in crossing a much larger distance
  106. * (usually right into some pit).
  107. *
  108. * TODO: Fix properly ;)
  109. */
  110.  
  111. if(currentmovetype != shouldmoveas && !GAMEL4DANY)
  112. {
  113. if(!(currentmovetype == MOVETYPE_LADDER && shouldmoveas == MOVETYPE_WALK))
  114. {
  115. SetEntityMoveType(client,shouldmoveas);
  116. }
  117. }
  118. }
  119. }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement