This repository has been archived by the owner on May 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jump.sqf
47 lines (37 loc) · 1.59 KB
/
jump.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
if (isNull player) exitwith {} ;
fn_Animation =
{
_unit = _this select 0;
_anim = _this select 1;
_unit switchMove _anim;// PLAY ANIMATION JUMP
//_unit playMovenow _anim;
};
dokeyDown={
private ["_r","_key_delay","_max_height"] ;
_key_delay = 0.3;// MAX TIME BETWEEN KEY PRESSES
_max_height = 4.3;// SET MAX JUMP HEIGHT
player setvariable ["key",false];
_r = false ;
// HINT STR (_this select 1);// show key number
// VARIOUS CHECKS
if (player getvariable["key",true] and (_this select 1) == 57) exitwith {player setvariable["key",false]; [_key_delay] spawn {sleep (_this select 0);player setvariable["key",true]; };_r};
if ((_this select 1) == 57 and speed player >8) then {
if (player == vehicle player and player getvariable ["jump",true] and isTouchingGround player ) then {
player setvariable["key",true];// RESTE DOUBLE KEY TAP
player setvariable ["jump",false];// DISABLE JUMP
_height = 6-((load player)*10);// REDUCE HEIGHT BASED ON WEIGHT
//hint str _height;
// MAKE JUMP IN RIGHT DIRECTION
_vel = velocity player;
_dir = direction player;
_speed = 0.4;
player setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)+_height];
[[player,"AovrPercMrunSrasWrflDf"],"fn_Animation",nil,false] spawn BIS_fnc_MP; //BROADCAST ANIMATION
player spawn {sleep 2;_this setvariable ["jump",true]};// RE-ENABLE JUMP
};
_r=true;
};
_r;
} ;
waituntil {!(IsNull (findDisplay 46))};
(FindDisplay 46) displayAddEventHandler ["keydown","_this call dokeyDown"];