• API
• FAQ
• Tools
• Trends
• Archive
daily pastebin goal
75%
SHARE
TWEET

# Untitled

darkarchon May 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. //////////////////////////////////////////////////////////////////
2. // Function file for Armed Assault
3. // Created by: kylania
4. //////////////////////////////////////////////////////////////////
5.
6. // Call this with the following line in the init field of the vehicle.
7. // this = object to slow.
8. // 60 = max speed for vehicle.
9. //
10. // null = [this, 60] execVM "speedlimit.sqf";
11.
12. // Pull the object and speed from the execVM.
13. _vehicle = _this select 0;
14. _maxspeed = _this select 1;
15.
16. // Figure current speed.
17. _curspeed = speed _vehicle;
18.
19. // If we're going to fast...
20. if (_curspeed > _maxspeed) then {
21.
22. // Grab the current velocity and direction of the vehicle.
23. _vel = velocity _vehicle;
24. _dir = direction _vehicle;
25.
26. // Limit it's to bring it back down to the max amount.
27. _speed = _curspeed - _maxspeed;
28.
29. // This is math I don't understand, grabbed it from the biki. :)
30. //_vehicle setVelocity [(_vel select 0)-(sin _dir*_speed),(_vel select 1)- (cos _dir*_speed),(_vel select 2)];
31. _vehicle setVelocity [(_vel select 0)/_curspeed * _maxspeed,(_vel select 1)/_curspeed * _maxspeed,(_vel select 2)/_curspeed * _maxspeed];
32.
33.
34. }; // End of if
35.
36. // Sleep tenth of a second, this might be too much processing.  I dunno, slower and the ride get jerkier though.
37. sleep 0.05;
38.
39. // Call the script again.
40. _null = [_vehicle, _maxspeed] execVM "speedlimit.sqf";
RAW Paste Data
Top