Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public OnGameFrame()
- {
- for(new client=1;client<=MaxClients;client++)
- {
- if(ValidPlayer(client,true))//&&!bIgnoreTrackGF[client])
- {
- new Float:currentmaxspeed=GetEntDataFloat(client,m_OffsetSpeed);
- //DP("speed %f, speedbefore %f , we set %f",currentmaxspeed,speedBefore[client],speedWeSet[client]);
- if(currentmaxspeed!=speedWeSet[client]) ///SO DID engien set a new speed? copy that!! //TFIsDefaultMaxSpeed(client,currentmaxspeed)){ //ONLY IF NOT SET YET
- {
- //DP("detected newspeed %f was %f",currentmaxspeed,speedWeSet[client]);
- speedBefore[client]=currentmaxspeed;
- reapplyspeed[client]++;
- }
- //PrintToChat(client,"speed %f %s",currentmaxspeed, TFIsDefaultMaxSpeed(client,currentmaxspeed)?"T":"F");
- if(reapplyspeed[client]>0)
- {
- // DP("reapply");
- reapplyspeed[client]=0;
- ///player frame tracking, if client speed is not what we set, we reapply speed
- //PrintToChatAll("1");
- if(War3_GetGame()==Game_TF)
- {
- // if(true|| speedBefore[client]>3.0){ //reapply speed, using previous cached base speed, make sure the cache isnt' zero lol
- new Float:speedmulti=1.0;
- //DP("before");
- //new Float:speedadd=1.0;
- if(!W3GetBuffHasTrue(client,bBuffDenyAll))
- {
- speedmulti=W3GetBuffMaxFloat(client,fMaxSpeed)+W3GetBuffMaxFloat(client,fMaxSpeed2)-1.0;
- }
- if(W3GetBuffHasTrue(client,bStunned)||W3GetBuffHasTrue(client,bBashed))
- {
- //DP("stunned or bashed");
- speedmulti=0.0;
- }
- if(!W3GetBuffHasTrue(client,bSlowImmunity))
- {
- speedmulti=FloatMul(speedmulti,W3GetBuffStackedFloat(client,fSlow));
- speedmulti=FloatMul(speedmulti,W3GetBuffStackedFloat(client,fSlow2));
- }
- //PrintToConsole(client,"speedmulti should be 1.0 %f %f",speedmulti,speedadd);
- gspeedmulti[client]=speedmulti;
- new Float:newmaxspeed=FloatMul(speedBefore[client],speedmulti);
- if(newmaxspeed<0.1)
- {
- newmaxspeed=0.1;
- }
- speedWeSet[client]=newmaxspeed;
- SetEntDataFloat(client,m_OffsetSpeed,newmaxspeed,true);
- //DP("%f",newmaxspeed);
- // }
- }
- else
- { //cs?
- new Float:speedmulti=1.0;
- //new Float:speedadd=1.0;
- if(!W3GetBuffHasTrue(client,bBuffDenyAll))
- {
- speedmulti=W3GetBuffMaxFloat(client,fMaxSpeed)+W3GetBuffMaxFloat(client,fMaxSpeed2)-1.0;
- }
- if(W3GetBuffHasTrue(client,bStunned)||W3GetBuffHasTrue(client,bBashed))
- {
- speedmulti=0.0;
- }
- if(!W3GetBuffHasTrue(client,bSlowImmunity))
- {
- speedmulti=FloatMul(speedmulti,W3GetBuffStackedFloat(client,fSlow));
- speedmulti=FloatMul(speedmulti,W3GetBuffStackedFloat(client,fSlow2));
- }
- if(GetEntDataFloat(client,m_OffsetSpeed)!=speedmulti)
- {
- SetEntDataFloat(client,m_OffsetSpeed,speedmulti);
- }
- }
- }
- new MoveType:currentmovetype=GetEntityMoveType(client);
- new MoveType:shouldmoveas=MOVETYPE_WALK;
- if(W3GetBuffHasTrue(client,bNoClipMode))
- {
- shouldmoveas=MOVETYPE_NOCLIP;
- }
- if(W3GetBuffHasTrue(client,bFlyMode)&&!W3GetBuffHasTrue(client,bFlyModeDeny))
- {
- shouldmoveas=MOVETYPE_FLY;
- }
- if(W3GetBuffHasTrue(client,bNoMoveMode))
- {
- shouldmoveas=MOVETYPE_NONE;
- }
- /* Glider (290611):
- * I have implemented a extremly dirty way to prevent some
- * shit that goes wrong in L4D2.
- *
- * If a tank tries to climb a object, he changes his
- * move type. This code prevented them from ever
- * climbing anything.
- *
- * Players also change their move type when they get
- * hit so hard they stagger into a direction, making
- * them move slower. This code made them stagger much
- * faster, resulting in crossing a much larger distance
- * (usually right into some pit).
- *
- * TODO: Fix properly ;)
- */
- if(currentmovetype != shouldmoveas && !GAMEL4DANY)
- {
- if(!(currentmovetype == MOVETYPE_LADDER && shouldmoveas == MOVETYPE_WALK))
- {
- SetEntityMoveType(client,shouldmoveas);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement