Lovelaz

RAGE MP

Jan 4th, 2021 (edited)
977
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Индексовый файл (Клиент)
  2. let shapeUI = mp.browsers.new("package://cef/npcUI/ui/index.html");
  3. shapeUI.active = false;
  4.  
  5. let dialogUI = mp.browsers.new("package://cef/npcUI/ui/dialog.html");
  6. dialogUI.active = false;
  7.  
  8. let player = mp.players.local;
  9. let camera = mp.cameras.new('default', new mp.Vector3( -799.003,  -1337.997, 5.150 + 0.50), new mp.Vector3(0, 0, 145), 50)
  10. var cameraActive = false;
  11.  
  12.  
  13. mp.keys.bind(0x45, true, function () {
  14.     if(shapeUI.active == true) {
  15.  
  16.         camera.setActive(true);
  17.         mp.game.cam.renderScriptCams(true, true, 500, true, false);
  18.         mp.game.ui.displayRadar(false);
  19.         player.freezePosition(true);
  20.         mp.gui.chat.activate(false)
  21.         mp.gui.chat.show(false);
  22.  
  23.         dialogUI.active = true;
  24.  
  25.         setTimeout(() => {
  26.             cameraActive = true;
  27.         }, 1000)
  28.     }
  29.  
  30.     if(cameraActive == true){
  31.         destroyCam(camera);
  32.     }
  33. });
  34.  
  35.  
  36. function destroyCam(cam) {
  37.     dialogUI.active = false;
  38.     shapeUI.active = false;
  39.     camera.setActive(false);
  40.     mp.game.ui.displayRadar(true);
  41.     player.freezePosition(false);
  42.     mp.gui.chat.activate(true)
  43.     mp.gui.chat.show(true);
  44.     mp.game.cam.renderScriptCams(false, false, 0, false, false);
  45. }
  46.  
  47.  
  48.  
  49. mp.events.add('playerEnterColshape', () => {
  50.     shapeUI.active = true;
  51. });
  52.  
  53. mp.events.add('playerExitColshape', () => {
  54.     shapeUI.active = false;
  55.    
  56. });
  57.  
  58. //Создание колшейпа (Сервераная часть)
  59. let x = -800.653;
  60. let y = -1340.330;
  61. let z = 5.150;
  62. let range = 1;
  63. let someColShape = mp.colshapes.newSphere(x, y, z, range);
  64.  
  65. function playerEnterColshapeHandler(player, shape) {
  66.     if(shape == someColShape) {
  67.         //player.outputChatBox("Вы в шейпе");
  68.     }
  69.   }
  70.  
  71. function playerExitColshapeHandler(player, shape) {
  72.     if(shape == someColShape) {
  73.        // player.outputChatBox("Вы выйшли из шейпа");
  74.  }
  75. }
  76.  
  77. mp.events.add("playerEnterColshape", playerEnterColshapeHandler);
  78. mp.events.add("playerExitColshape", playerExitColshapeHandler);
  79.  
  80. //В папке CEF создать папку npcUI в ней ui. В папке ui создать файлы: index.html style.css dialog.html dialog.css
  81. //В файл index.html вставить следующий код:
  82.  
  83. <!DOCTYPE html>
  84. <html lang="en">
  85. <head>
  86.     <meta charset="UTF-8">
  87.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  88.     <link rel="stylesheet" href="style.css">
  89.     <link rel="preconnect" href="https://fonts.gstatic.com">
  90.     <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans&display=swap" rel="stylesheet">
  91.     <title>Document</title>
  92. </head>
  93. <body>
  94.     <div id="block">
  95.         <div id="notify">
  96.             Нажмите Е для взаимодействия
  97.         </div> 
  98. </div>
  99. </body>
  100. </html>
  101.  
  102. //В файл style.css вставить следующий код:
  103.  
  104. body {
  105.     font-family: 'IBM Plex Sans', sans-serif;
  106.    
  107. }
  108.  
  109. #block {
  110.     padding-top: 5px;
  111.     text-align: center;
  112.     margin-top: 500px;
  113.     margin-left: 650px;
  114.  
  115.     width: 300px;
  116.     height: 30px;
  117.     background: #000000;
  118.     opacity: 0.9;
  119.     color: #fff;
  120.     user-select: none;
  121. }
  122.  
  123.  
  124. #block {
  125.     opacity: 0.7;
  126.     border-radius: 5px;
  127.     margin-top: 730px;
  128.     margin-left: 650px;
  129. }
  130.  
  131. //В файл dialog.html вставить следующий код:
  132.  
  133. <!DOCTYPE html>
  134. <html lang="en">
  135. <head>
  136.     <meta charset="UTF-8">
  137.     <link rel="stylesheet" href="dialog.css">
  138.     <link rel="preconnect" href="https://fonts.gstatic.com">
  139. <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@700&display=swap" rel="stylesheet">
  140.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  141.     <title>Document</title>
  142. </head>
  143. <body>
  144.     <div id="block">
  145.         Привет, меня Джек зовут, вижу ты только приехал. Поверни голову на право там увидишь скутеры с бесплатной арендой только для новоприбывших.
  146.        Также вот держи тебе деньги для старта и начала успешной жизни. Всё в твоих руках.
  147.     </div>
  148. </body>
  149. </html>
  150.  
  151. //В файл dialog.css вставить следующий код:
  152.  
  153. body {
  154.     font-family: 'Roboto', sans-serif;
  155. }
  156.  
  157. #dialog {
  158.     margin-left: 500px;
  159.     margin-top: 450px;
  160. }
  161. #block {
  162.     padding-top: 5px;
  163.     text-align: center;
  164.     margin-top: 500px;
  165.     margin-left: 650px;
  166.  
  167.     width: 600px;
  168.     height: 80px;
  169.     background: #000000;
  170.     color: #fff;
  171.     user-select: none;
  172. }
  173.  
  174.  
  175. #block {
  176.     opacity: 0.7;
  177.     border-radius: 5px;
  178.     margin-top: 500px;
  179.     margin-left: 430px;
  180. }
  181.  
  182. //Создаём персонажа (на клиенте)
  183.  
  184. let noname = mp.peds.new(
  185.     mp.game.joaat('csb_imran'), //можете менять пэд на свой по этой ссылке: https://wiki.rage.mp/index.php?title=Peds
  186.     new mp.Vector3(-800.653, -1340.330, 5.150), -11.121, //в скобка местоположение персонажа, а число за скобками rotation
  187.     0
  188. );
Add Comment
Please, Sign In to add comment