PDA

View Full Version : change gravity on pistol



malyczolg
10th June 2013, 17:00
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 ?

Ni3ls
10th June 2013, 17:17
cant, you can only let a player bounce if he has that gun ( give him a boost)

randall
10th June 2013, 17:25
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.

IzNoGoD
10th June 2013, 17:37
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

IzNoGoD
10th June 2013, 17:37
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

kung foo man
10th June 2013, 18:42
Swimzoring by IzNoGod:




#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(i = 0; i < waters.size; i++)
{
if(self istouching(waters[i]))
{
touching = true;
break;
}
}
vec = (0, 0, 0);
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 -= (0, 0, 1);
if(self leanrightButtonPressed())
vec += (0, 0, 1);
vec = vectornormalize(vec);
vec = maps\mp\_utility::vectorScale(vec, swimspeed);
}
if(touching)
{
currentspeed = self getVelocity();
speed_diff = vec - currentspeed;
speed = (speed_diff[0] * swimfactor, speed_diff[1] * swimfactor, speed_diff[2] * swimfactor + swimcorrection * (1 - 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;
}

IzNoGoD
10th June 2013, 19:14
hey that looks like my script

RobsoN
11th June 2013, 21:52
Use
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:


_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 finishPlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime );
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)