Raised This Month: $51 Target: $400
 12% 

Changing Clients Speed Without using "m_flLaggedMovementValue"


Post New Thread Reply   
 
Thread Tools Display Modes
Master53
Veteran Member
Join Date: Dec 2009
Old 08-05-2010 , 10:59   Re: Changing Clients Speed Without using "m_flLaggedMovementValue"
Reply With Quote #11

Quote:
Originally Posted by javalia View Post
i made this code for my tactical gunmod`s maximum speed suit fucntion

lol this code is crap but it works lol

Code:
if(suitmode[client] == suitmode_speed){
            
            if(((buttons & IN_FORWARD) || (buttons & IN_BACK) || (buttons & IN_MOVELEFT) || (buttons & IN_MOVERIGHT)) && !(buttons & IN_DUCK) && !(buttons & IN_SPEED) && (GetEntityFlags(client) & FL_ONGROUND)){
                
                if(armorvalue >= SUIT_SPEED_ENERGY){
                
                    decl Float:playerspeed[3], Float:clienteyeangle[3], Float:anglevector[3];
                    GetEntPropVector(client, Prop_Data, "m_vecVelocity", playerspeed);
                    
                    GetClientEyeAngles(client, clienteyeangle);
                    clienteyeangle[0] = 0.0;
                    
                    //플레이어의 위와 아래로 가는 속도는 기존 속도에서 가져오고,
                    //플레이어가 갈 방향의 속도를 플레이어의 눈 각도로부터 만든 벡터에서 가져온다
                    //눌린 이동버튼의 조합을 통해서 이동할 방향을 구한다
                    
                    //앞이나 뒤중 하나만이 눌려있거나 아무것도 눌려선 안된다
                    if(((buttons & IN_FORWARD) && !(buttons & IN_BACK)) || (!(buttons & IN_FORWARD) && (buttons & IN_BACK))|| (!(buttons & IN_FORWARD) && !(buttons & IN_BACK))){
                        
                        //좌나 우중 하나 혹은 아무것도 눌려있어선 안된다
                        if(((buttons & IN_MOVELEFT) && !(buttons & IN_MOVERIGHT)) || (!(buttons & IN_MOVELEFT) && (buttons & IN_MOVERIGHT)) || (!(buttons & IN_MOVELEFT) && !(buttons & IN_MOVERIGHT))){
                            
                            //앞으로 가기 버튼이 눌린 경우
                            if(buttons & IN_FORWARD){
                                
                                //왼쪽이 눌린 경우
                                if(buttons & IN_MOVELEFT){
                                    
                                    clienteyeangle[1] = clienteyeangle[1] + 45.0;
                                    
                                }else if(buttons & IN_MOVERIGHT){
                                    
                                    //오른쪽이 눌린 경우
                                    clienteyeangle[1] = clienteyeangle[1] - 45.0;
                                    
                                }
                                
                            }else if(buttons & IN_BACK){
                                
                                //방향을 뒤로
                                clienteyeangle[1] = clienteyeangle[1] + 180.0;
                                
                                //왼쪽이 눌린 경우
                                if(buttons & IN_MOVELEFT){
                                    
                                    clienteyeangle[1] = clienteyeangle[1] - 45.0;
                                    
                                }else if(buttons & IN_MOVERIGHT){
                                    
                                    //오른쪽이 눌린 경우
                                    clienteyeangle[1] = clienteyeangle[1] + 45.0;
                                    
                                }
                                
                            }else{
                                
                                //왼쪽이 눌린 경우
                                if(buttons & IN_MOVELEFT){
                                    
                                    clienteyeangle[1] = clienteyeangle[1] + 90.0;
                                    
                                }else if(buttons & IN_MOVERIGHT){
                                    
                                    //오른쪽이 눌린 경우
                                    clienteyeangle[1] = clienteyeangle[1] - 90.0;
                                    
                                }
                                
                            }
                            
                        }
                        
                    }
                    
                    GetAngleVectors(clienteyeangle, anglevector, NULL_VECTOR, NULL_VECTOR);
                    NormalizeVector(anglevector, anglevector);
                    ScaleVector(anglevector, 40.0);
                    AddVectors(playerspeed, anglevector, playerspeed);
                    
                    if(GetVectorLength(playerspeed) >= SUIT_SPEED_MAXSPEED){
                        
                        NormalizeVector(playerspeed, playerspeed);
                        ScaleVector(playerspeed, SUIT_SPEED_MAXSPEED);
                        
                    }
                    
                    TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, playerspeed);
                    
                    if(nextsuitactivetime[client] < nowtime){
                    
                        nextsuitactivetime[client] = nowtime + SUIT_SPEED_DELAY;
                        SetEntProp(client, Prop_Data, "m_ArmorValue", armorvalue - SUIT_SPEED_ENERGY); 
                        
                    }
                    
                }else{
                    
                    PrintToChat(client, "\x04%T", "suitenergydepleted", client);
                    nextsuitactivetime[client] = nowtime + SUIT_CHARGE_DELAY;
                    suitmode[client] = suitmode_charge;
                    
                    cancelreservesuithelpsound(client);
                    playsuithelpsound(client, SOUNDSUITNOENERGY);
                    
                }
                
            }
            
        }

this is really bad coding and i wouldnt recomend using this anyhow. i want an actual player speed. i tryed m_flMaxspeed but i got a glitchy resuit ill try do it another way
__________________
Master(d)



Master53 is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 08-05-2010 , 15:01   Re: Changing Clients Speed Without using "m_flLaggedMovementValue"
Reply With Quote #12

I wouldn't call that bad coding, more like a bad method if anything. If that actually increases player speed by applying velocity vectors then that's pretty impressive to me. And theoretically, it should be perfectly possible to make a person walk by applying velocity vectors. It's probably how the engine does it too, but probably not so low-level.
__________________
Greyscale is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 08-05-2010 , 15:03   Re: Changing Clients Speed Without using "m_flLaggedMovementValue"
Reply With Quote #13

Quote:
Originally Posted by Greyscale View Post
I wouldn't call that bad coding, more like a bad method if anything. If that actually increases player speed by applying velocity vectors then that's pretty impressive to me.
If Master talks about someone elses coding in a bad way, just ignore it, he doesn't know better.

More Ontopic: I am puzzled why they changed the mechanics to such a bull in ep2 engines, no real use in it, right?
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 08-05-2010 , 20:24   Re: Changing Clients Speed Without using "m_flLaggedMovementValue"
Reply With Quote #14

I don't know how it works in ep2, but in CS:S, the speed was set in the weapons. Works for their purposes, but just makes it harder for us to do stuff. They could have a base max speed property on the client, and then the weapon subtracts from that base speed. That's more logical to me.
__________________
Greyscale is offline
Mnkras
Senior Member
Join Date: Mar 2009
Location: 127.0.0.1
Old 08-05-2010 , 23:22   Re: Changing Clients Speed Without using "m_flLaggedMovementValue"
Reply With Quote #15

if your doing it in TF2 you can use TF2 items, iv used m_flMaxspeed and its worked for me
__________________
Mnkras is offline
Reply



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 05:45.


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