Results 1 to 8 of 8

Thread: change gravity on pistol

  1. #1
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts

    change gravity on pistol

    hi , how can i change gravity on pistol ?
    np : if i have mp44 gravity is normal , if i change weapon to pistol my jump is higher ?

  2. #2
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    cant, you can only let a player bounce if he has that gun ( give him a boost)

  3. #3
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    You cannot. Gravity is a server cvar what affects every players.
    Try to call a "fake" damage under the player (it will "jog" the user, if i remember well you can find script for this in the site) if the current gun is a pistol.

  4. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    look@the swimming mod i made for kung's extension.
    You could clone that using normal playerdamage and only apply it on players which are wielding the pistol

  5. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    look@the swimming mod i made for kung's extension.
    You could clone that using normal playerdamage and only apply it on players which are wielding the pistol

  6. #6
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Swimzoring by IzNoGod:


    PHP Code:
    #include std\player;

    swim()
    {
        
    swimspeed 200;
        
    swimfactor 0.05;
        
    swimcorrection 35.5//experimental random number (do not change)
        
    if(isdefined(self.swim_running) && self.swim_running)
            return; 
    //dont double-start thread
        
    waters getentarray("water""targetname");
        
    touching false;
        
    wastouching false;
        while(
    isdefined(self) && isdefined(self.sessionstate) && self.sessionstate == "playing")
        {
            
    wastouching touching;
            
    touching false;
            for(
    0waters.sizei++)
            {
                if(
    self istouching(waters[i]))
                {
                    
    touching true;
                    break;
                }
            }
            
    vec = (000);
            if(
    touching || wastouching)
            {
                
    fw anglestoforward(self getplayerangles());
                
    rg anglestoright(self getplayerangles());
                if(
    self leftButtonPressed())
                    
    vec -= rg;
                if(
    self rightButtonPressed())
                    
    vec += rg;
                if(
    self forwardButtonPressed())
                    
    vec += fw;
                if(
    self backButtonPressed())
                    
    vec -= fw;
                if(
    self leanleftButtonPressed())
                    
    vec -= (001);
                if(
    self leanrightButtonPressed())
                    
    vec += (001);
                
    vec vectornormalize(vec);
                
    vec maps\mp\_utility::vectorScale(vecswimspeed);
            }
            if(
    touching)
            {
                
    currentspeed self getVelocity();
                
    speed_diff vec currentspeed;
                
    speed = (speed_diff[0] * swimfactorspeed_diff[1] * swimfactorspeed_diff[2] * swimfactor swimcorrection * (0.5 self isonground()));
                
    self addVelocity(speed);
            }
            else if(
    wastouching && (vec[2] > swimspeed/10 || self jumpButtonPressed()))
            {
                
    currentspeed self getVelocity();
                
    currentspeed = (currentspeed[0], currentspeed[1], 250);
                
    self setvelocity(currentspeed);
            }
            
    wait 0.05;
        }
        if(
    isdefined(self))
            
    self.swim_running false;

    timescale 0.01

  7. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    hey that looks like my script

  8. The Following User Says Thank You to IzNoGoD For This Useful Post:

    kung foo man (11th June 2013)

  9. #8
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    Use
    PHP Code:
    finishPlayerDamage 
    to kick player higher. There is a lot of mods like High jump SD using this trick. Here is code for one jump with attack button pressed:

    PHP Code:
    _jump()
    {
        
    self endon("disconnect");
        
        while(
    1)
        {
            if(!
    self isonground() && self attackButtonPressed())
            {
                
    boostjump 5000//BOOST HERE
                
                
    self.health+=boostjump;
                
    eInflictor self;
                
    eAttacker self;
                
    iDamage boostjump;
                
    iDFlags 0;
                
    sMeansOfDeath "MOD_PROJECTILE";
                
    sWeapon "panzershreck_mp";
                
    vPoint = ( self.origin+(0,0,-1) );
                
    vDir = (0,0,1);
                
    sHitLoc "none";
                
    psOffsetTime 0;
                
    self finishPlayerDamageeInflictoreAttackeriDamageiDFlagssMeansOfDeathsWeaponvPointvDirsHitLocpsOffsetTime );
                
    wait 0.05;
                return;
            }
            
            
    wait 0.05;
        }

    There is just one problem, you need to bind space, or something to know when player want to jump, because "isOnGround" function is called aslo if player is in the air (eg. jumping out from some building)

  10. The Following User Says Thank You to RobsoN For This Useful Post:

    kung foo man (11th June 2013)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •