SHARE
TWEET

Untitled

kot69 Aug 25th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- © Copyright, Maximilian Brandmaier (SuperBrandy), 2014
  2. -- All contents of this Project are protected by Copyright.
  3.  
  4. --[OPTIONS] EDIT HERE
  5.  
  6. local DogPanelKey = "F5" --Default F6
  7. local ChangeStatusKey = "L" --Default P
  8. local DoTrickKey = "K" --Default O
  9. local Language = "English" --English/German
  10. local EnableCheats = true --Default false
  11.  
  12. ---------------------------------------------------------NO EDIT---------------------------------------------------------
  13. --VALUES
  14. local DMClientOwnerGotDog
  15. local DMClientDogRace
  16. local DMClientDogName
  17. local DMClientDogFitness
  18. local DMClientDogStrength
  19. local DMDogRace
  20. local DMClientDogGender
  21.  
  22. --VARIABLES
  23. local DMDogPanel
  24. local DMClientOwnerGotDog
  25. local DMAttacker
  26. local DMAttackCount
  27. local DMDogAttacking
  28. local DMHelpActive
  29. local DMDogFitnessTimerWasOn
  30. local DMStatusGuiWasOn
  31. local DMDogSpawned
  32. local DMDogDistanceAnimation
  33. local DMFeedActive
  34. local DMTricksDogPanel
  35. local DMTrickTutorial
  36. local DMCursorx, DMCursory, DMworldx, DMworldy, DMworldz
  37. local DMStopCursorx, DMStopCursory, DMstopworldx, DMStopworldy, DMStopworldz
  38. local DMTricksTutorialActive
  39. local DMStatusActive
  40. local DMDogDeathTimerCount
  41. local DMDogDeathRevive
  42. local DMDogFollow
  43. local DMBallThrowActive
  44. local DMInventoryBallOnGround
  45. local DMCreatorActive
  46. local DogGuardingx, DogGuardingy, DogGuardingz
  47. local DMGuardFollowActive
  48. local DMDogAttack
  49. local DMDogGuardActive
  50. local DMDogTasksPanel
  51. local DMDogFightPanel
  52. local DMDogFightRequestPanel
  53. local DMOnlySpawn
  54. local DMPlayerInFight
  55. local DMRequestClose
  56. local DMDogCreationGender
  57. local DMAttackSound2Active
  58. local DMDogSniffPanel
  59.  
  60. --COLORS
  61. local DMDogCreationColorR
  62. local DMDogCreationColorG
  63. local DMDogCreationColorB
  64.  
  65. local DMClientDogGenderColorR
  66. local DMClientDogGenderColorG
  67. local DMClientDogGenderColorB
  68.  
  69. --OBJECTS
  70. local DMClientDog
  71. local DMDogIdleBlip
  72. local DMBall
  73. local DMGuardCollision
  74. local DMGuardPlayerFound
  75. local DMRequestPlayer
  76. local DMClientRequestDog
  77. local DMAttackSound2Object
  78. local DMGuardSound2Object
  79. local DMDogSniffBlip
  80.  
  81. --TIMER
  82. local DMPositionSyncTimer
  83. local DMDogFitnessTimer
  84. local DMDogHungerTimer
  85. local DMDogEatTimer
  86. local DMGetCoursorPosTimer
  87. local DMDogDeathTimer
  88. local DMDogIdleTimer
  89. local DMInventoryGetBallTimer
  90. local DMGotBallTimer
  91. local DMDogGuardingTimer
  92. local DMAttackSound1Timer
  93. local DMAttackSound2Timer
  94. local DMGuardSound1Timer
  95. local DMGuardSound2Timer
  96.  
  97. --DXDRAW
  98. local DMScreenx, DMScreeny = guiGetScreenSize()
  99. local DMTextSizex = ((DMScreenx/1920)/2) + 0.5
  100. local DMTextSizey = ((DMScreeny/1080)/2) + 0.5
  101. local DMImagex =  DMScreenx/1920
  102. local DMImagey =  DMScreeny/1080
  103.  
  104. --GUI
  105. local DMDogNameEdit
  106. local DMDogNameButton1
  107. local DMDogNameButton2
  108. local DMDogNameButton3
  109. local DMDogNameButton4
  110. local DMDogNameButton5
  111. local DMDogNameButton6
  112. local DMDogNameButton7
  113.  
  114. local DMDogPanelButton1
  115. local DMDogPanelButton2
  116. local DMDogPanelButton3
  117. local DMDogPanelButton4
  118. local DMDogPanelButton5
  119. local DMDogPanelButton6
  120. local DMDogPanelButton7
  121.  
  122. local DMHelpButton1
  123.  
  124. local DMTricksDogButton1
  125. local DMTricksDogButton2
  126. local DMTricksDogButton3
  127. local DMTricksDogButton4
  128. local DMTricksDogButton5
  129. local DMTricksDogButton6
  130. local DMTricksDogButton7
  131.  
  132. local DMDogTasksButton1
  133. local DMDogTasksButton2
  134. local DMDogTasksButton3
  135. local DMDogFightEdit
  136. local DMDogFightButton
  137. local DMDogSniffButton
  138. local DMDogSniffEdit
  139.  
  140. local DMDogFightRequestButton1
  141. local DMDogFightRequestButton2
  142.  
  143. --Textures
  144. local texture1
  145. local texture2
  146. local texture3
  147. local texture4
  148. local texture5
  149. local texture6
  150. local texture7
  151. local texture8
  152.  
  153. --Sounds
  154.  
  155. local DMAttackStatusSound
  156. local DMAttackSound1
  157. local DMAttackSound2
  158. local DMGuardSound1
  159. local DMGuardSound2
  160. local DMFightSound1
  161. local DMFightSound2
  162.  
  163. --Language
  164.  
  165. local DMLanguage
  166.  
  167. --.Functions.--
  168. local white = tocolor(255,255,255,255)
  169. function dxDrawImage3D(x,y,z,w,h,m,c,r,...)
  170.         local lx, ly, lz = x+w, y+h, (z+tonumber(r or 0)) or z
  171.     return dxDrawMaterialLine3D(x,y,z, lx, ly, lz, m, h, c or white, ...)
  172. end
  173. function DMRound(num, idp)
  174.   local mult = 10^(idp or 0)
  175.   return math.floor(num * mult + 0.5) / mult
  176. end
  177.  
  178.  
  179. --CHECK FOR DOG
  180. function DMCheckOwnerBack(DMOwnerGotDog, DMDogName, DMDogRace,DMDogFitness,DMDogStrength, DMDogGender)
  181. if(DMOwnerGotDog == true)then
  182. DMClientDogRace = DMDogRace
  183. DMClientDogName = DMDogName
  184. DMClientOwnerGotDog = DMOwnerGotDog
  185. DMClientDogFitness = DMDogFitness
  186. DMClientDogStrength = DMDogStrength
  187. DMClientDogGender = DMDogGender
  188. if(DMClientDogGender == "male")then
  189. DMClientDogGenderColorR = 51
  190. DMClientDogGenderColorG = 204
  191. DMClientDogGenderColorB = 255
  192. elseif(DMClientDogGender == "female")then
  193. DMClientDogGenderColorR = 255
  194. DMClientDogGenderColorG = 51
  195. DMClientDogGenderColorB = 204
  196. end
  197. else
  198. DMClientOwnerGotDog = false
  199. end
  200. end
  201.  
  202.  
  203. --DOG CREATOR
  204. function DMCreateDog()
  205. if(DMClientOwnerGotDog == true)then
  206. if(DMLanguage == 1)then
  207. outputChatBox("У вас уже есть собака!", 255, 0,0)
  208. elseif(DMLanguage == 2)then
  209. outputChatBox("Du hast bereits einen Hund!", 255, 0,0)
  210. end
  211. else
  212. if(DMDogPanel == true)then
  213. removeEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  214. DMDogPanel = false
  215.  
  216. guiSetVisible(DMDogPanelButton1, false)
  217. guiSetVisible(DMDogPanelButton2, false)
  218. guiSetVisible(DMDogPanelButton3, false)
  219. guiSetVisible(DMDogPanelButton4, false)
  220. guiSetVisible(DMDogPanelButton5, false)
  221. guiSetVisible(DMDogPanelButton6, false)
  222. guiSetVisible(DMDogPanelButton7, false)
  223.  
  224. showCursor(false)
  225. end
  226.  
  227. --setTime( 12, 1 )
  228. DMCreatorActive = true
  229. local player = getLocalPlayer()
  230.  
  231.  
  232. DMPlayerSkin = getElementModel(player)
  233. DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(player)
  234. setElementInterior ( player, 20, 0, 0, 0)
  235. setElementPosition( player, 0, -1, -2)
  236. setElementFrozen ( player, true )
  237.  
  238. setCameraMatrix(0, -3, 0, 0.1, 0.3, -0.2)
  239. showCursor(true)
  240. guiSetInputEnabled(true)
  241.  
  242. DMDogRace = 290
  243. DMDogCreationGender = "male"
  244. DMDogCreationColorR = 51
  245. DMDogCreationColorG = 204
  246. DMDogCreationColorB = 255
  247.  
  248. addEventHandler("onClientRender", getRootElement(), DMDogCreationGui)
  249. guiSetVisible(DMDogNameEdit, true)
  250. guiSetVisible(DMDogNameButton1, true)
  251. guiSetVisible(DMDogNameButton2, true)
  252. guiSetVisible(DMDogNameButton3, true)
  253. guiSetVisible(DMDogNameButton4, true)
  254. guiSetVisible(DMDogNameButton5, true)
  255. guiSetVisible(DMDogNameButton6, true)
  256. guiSetVisible(DMDogNameButton7, true)
  257. end
  258. end
  259.  
  260. function DMDogCreationRaceLeft()
  261. if(DMDogRace == 290 or DMDogRace == 291 or DMDogRace == 292)then
  262.   DMDogRace = 299
  263. elseif(DMDogRace == 293 or DMDogRace == 294 or DMDogRace == 295 or DMDogRace == 296)then
  264.   DMDogRace = 290
  265. elseif(DMDogRace == 297 or DMDogRace == 298)then
  266.   DMDogRace = 293
  267. elseif(DMDogRace == 299)then
  268.   DMDogRace = 297
  269. end
  270.  
  271. destroyElement(DMDogCreatorPed)
  272. DMDogCreatorPed = createPed( DMDogRace , 0.1, 0.3, -0.2 , 90)
  273. setElementInterior ( DMDogCreatorPed, 20, 0.1, 0.3, -0.2)
  274. end
  275.  
  276. function DMDogCreationRaceRight()
  277. if(DMDogRace == 290 or DMDogRace == 291 or DMDogRace == 292)then
  278.   DMDogRace = 293
  279. elseif(DMDogRace == 293 or DMDogRace == 294 or DMDogRace == 295 or DMDogRace == 296)then
  280.   DMDogRace = 297
  281. elseif(DMDogRace == 297 or DMDogRace == 298)then
  282.   DMDogRace = 299
  283. elseif(DMDogRace == 299)then
  284.   DMDogRace = 290
  285. end
  286.  
  287.  
  288. destroyElement(DMDogCreatorPed)
  289. DMDogCreatorPed = createPed( DMDogRace , 0.1, 0.3, -0.2 , 90)
  290. setElementInterior ( DMDogCreatorPed, 20, 0.1, 0.3, -0.2)
  291. end
  292.  
  293. function DMDogCreationSizeLeft()
  294. if(DMDogRace == 290)then
  295. DMDogRace = 292
  296. elseif(DMDogRace == 291)then
  297. DMDogRace = 290
  298. elseif(DMDogRace == 292)then
  299. DMDogRace = 291
  300.  
  301. elseif(DMDogRace == 293)then
  302. DMDogRace = 296
  303. elseif(DMDogRace == 294)then
  304. DMDogRace = 293
  305. elseif(DMDogRace == 295)then
  306. DMDogRace = 294
  307. elseif(DMDogRace == 296)then
  308. DMDogRace = 295
  309.  
  310. elseif(DMDogRace == 297)then
  311. DMDogRace = 298
  312. elseif(DMDogRace == 298)then
  313. DMDogRace = 297
  314. end
  315.  
  316. destroyElement(DMDogCreatorPed)
  317. DMDogCreatorPed = createPed( DMDogRace , 0.1, 0.3, -0.2 , 90)
  318. setElementInterior ( DMDogCreatorPed, 20, 0.1, 0.3, -0.2)
  319. end
  320.  
  321. function DMDogCreationSizeRight()
  322. if(DMDogRace == 290)then
  323. DMDogRace = 291
  324. elseif(DMDogRace == 291)then
  325. DMDogRace = 292
  326. elseif(DMDogRace == 292)then
  327. DMDogRace = 290
  328.  
  329. elseif(DMDogRace == 293)then
  330. DMDogRace = 294
  331. elseif(DMDogRace == 294)then
  332. DMDogRace = 295
  333. elseif(DMDogRace == 295)then
  334. DMDogRace = 296
  335. elseif(DMDogRace == 296)then
  336. DMDogRace = 293
  337.  
  338. elseif(DMDogRace == 297)then
  339. DMDogRace = 298
  340. elseif(DMDogRace == 298)then
  341. DMDogRace = 297
  342. end
  343.  
  344. destroyElement(DMDogCreatorPed)
  345. DMDogCreatorPed = createPed( DMDogRace , 0.1, 0.3, -0.2 , 90)
  346. setElementInterior ( DMDogCreatorPed, 20, 0.1, 0.3, -0.2)
  347. end
  348.  
  349. function DMDogCreationGender()
  350. if(source == DMDogNameButton6)then
  351. DMDogCreationGender = "male"
  352. DMDogCreationColorR = 51
  353. DMDogCreationColorG = 204
  354. DMDogCreationColorB = 255
  355. elseif(source == DMDogNameButton7)then
  356. DMDogCreationGender = "female"
  357. DMDogCreationColorR = 255
  358. DMDogCreationColorG = 51
  359. DMDogCreationColorB = 204
  360. end
  361. end
  362.  
  363. function DMDogCreationGui()
  364. if(DMLanguage == 1)then
  365. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.42 * DMScreeny, tocolor(20, 20, 20, 220))
  366. dxDrawText("Создание собаки", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMDogCreationColorR, DMDogCreationColorG, DMDogCreationColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  367.  
  368. dxDrawText("Имя", 0.785 * DMScreenx, 0.34 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  369. dxDrawRectangle(0.789 * DMScreenx, 0.361 * DMScreeny, 0.152 * DMScreenx, 0.048 * DMScreeny, tocolor(DMDogCreationColorR, DMDogCreationColorG, DMDogCreationColorB, 220))
  370.  
  371. dxDrawText("порода", 0.785 * DMScreenx, 0.43 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  372. dxDrawRectangle(0.789 * DMScreenx, 0.451 * DMScreeny, 0.152 * DMScreenx, 0.048 * DMScreeny, tocolor(DMDogCreationColorR, DMDogCreationColorG, DMDogCreationColorB, 220))
  373. dxDrawText("<", 0.789 * DMScreenx, 0.45 * DMScreeny, 0.809 * DMScreenx, 0.51 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  374. dxDrawText(">", 0.922 * DMScreenx, 0.45 * DMScreeny, 0.942 * DMScreenx, 0.51 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  375.  
  376. local DMRaceText
  377. if(DMDogRace == 290 or DMDogRace == 291 or DMDogRace == 292)then
  378. DMRaceText = "Sheperd"
  379. elseif(DMDogRace == 293 or DMDogRace == 294 or DMDogRace == 295 or DMDogRace == 296)then
  380. DMRaceText = "Pitbull"
  381. elseif(DMDogRace == 297 or DMDogRace == 298)then
  382. DMRaceText = "Golden Retriever"
  383. elseif(DMDogRace == 299)then
  384. DMRaceText = "Rottweiler"
  385. end
  386. dxDrawText(DMRaceText, 0.789 * DMScreenx, 0.451 * DMScreeny, 0.9412 * DMScreenx, 0.499 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  387.  
  388.  
  389. dxDrawText("Цвет меха", 0.785 * DMScreenx, 0.52 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  390. dxDrawRectangle(0.789 * DMScreenx, 0.541 * DMScreeny, 0.152 * DMScreenx, 0.048 * DMScreeny, tocolor(DMDogCreationColorR, DMDogCreationColorG, DMDogCreationColorB, 220))
  391. dxDrawText("<", 0.789 * DMScreenx, 0.54 * DMScreeny, 0.809 * DMScreenx, 0.6 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  392. dxDrawText(">", 0.922 * DMScreenx, 0.54 * DMScreeny, 0.942 * DMScreenx, 0.6 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  393. local DMFurColorText
  394. if(DMDogRace == 290)then
  395. DMFurColorText = "Black"
  396. elseif(DMDogRace == 291)then
  397. DMFurColorText = "Black & White"
  398. elseif(DMDogRace == 292)then
  399. DMFurColorText = "Black & Brown"
  400. elseif(DMDogRace == 293)then
  401. DMFurColorText = "Brown"
  402. elseif(DMDogRace == 294)then
  403. DMFurColorText = "White"
  404. elseif(DMDogRace == 295)then
  405. DMFurColorText = "Grey"
  406. elseif(DMDogRace == 296)then
  407. DMFurColorText = "Black & White"
  408. elseif(DMDogRace == 297)then
  409. DMFurColorText = "Brown"
  410. elseif(DMDogRace == 298)then
  411. DMFurColorText = "White"
  412. elseif(DMDogRace == 299)then
  413. DMFurColorText = "Black & Brown"
  414. end
  415. dxDrawText(DMFurColorText, 0.789 * DMScreenx, 0.541 * DMScreeny, 0.9412 * DMScreenx, 0.589 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  416.  
  417. dxDrawText("Пол", 0.785 * DMScreenx, 0.61 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  418. dxDrawImage(0.82 * DMScreenx, 0.625 * DMScreeny, 40 * DMImagex, 35 * DMImagey, texture7  )
  419. dxDrawImage(0.88 * DMScreenx, 0.625 * DMScreeny, 45 * DMImagex, 40 * DMImagey, texture8  )
  420.  
  421. dxDrawImage(0.9 * DMScreenx, 0.67 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  422. dxDrawText("Готово", 0.9 * DMScreenx, 0.675 * DMScreeny, DMScreenx * 0.943, DMScreeny * 0.713, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  423.  
  424. elseif(DMLanguage == 2)then
  425. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.42 * DMScreeny, tocolor(20, 20, 20, 220))
  426. dxDrawText("Создать собаку", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMDogCreationColorR, DMDogCreationColorG, DMDogCreationColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  427.  
  428. dxDrawText("Имя", 0.785 * DMScreenx, 0.34 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  429. dxDrawRectangle(0.789 * DMScreenx, 0.361 * DMScreeny, 0.152 * DMScreenx, 0.048 * DMScreeny, tocolor(DMDogCreationColorR, DMDogCreationColorG, DMDogCreationColorB, 220))
  430.  
  431. dxDrawText("порода", 0.785 * DMScreenx, 0.43 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  432. dxDrawRectangle(0.789 * DMScreenx, 0.451 * DMScreeny, 0.152 * DMScreenx, 0.048 * DMScreeny, tocolor(DMDogCreationColorR, DMDogCreationColorG, DMDogCreationColorB, 220))
  433. dxDrawText("<", 0.789 * DMScreenx, 0.45 * DMScreeny, 0.809 * DMScreenx, 0.51 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  434. dxDrawText(">", 0.922 * DMScreenx, 0.45 * DMScreeny, 0.942 * DMScreenx, 0.51 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  435.  
  436. local DMRaceText
  437. if(DMDogRace == 290 or DMDogRace == 291 or DMDogRace == 292)then
  438. DMRaceText = "Schäferhund"
  439. elseif(DMDogRace == 293 or DMDogRace == 294 or DMDogRace == 295 or DMDogRace == 296)then
  440. DMRaceText = "Pitbull"
  441. elseif(DMDogRace == 297 or DMDogRace == 298)then
  442. DMRaceText = "Golden Retriever"
  443. elseif(DMDogRace == 299)then
  444. DMRaceText = "Rottweiler"
  445. end
  446. dxDrawText(DMRaceText, 0.789 * DMScreenx, 0.451 * DMScreeny, 0.9412 * DMScreenx, 0.499 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  447.  
  448. dxDrawText("Fellfarbe", 0.785 * DMScreenx, 0.52 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  449. dxDrawRectangle(0.789 * DMScreenx, 0.541 * DMScreeny, 0.152 * DMScreenx, 0.048 * DMScreeny, tocolor(DMDogCreationColorR, DMDogCreationColorG, DMDogCreationColorB, 220))
  450. dxDrawText("<", 0.789 * DMScreenx, 0.54 * DMScreeny, 0.809 * DMScreenx, 0.6 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  451. dxDrawText(">", 0.922 * DMScreenx, 0.54 * DMScreeny, 0.942 * DMScreenx, 0.6 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  452. local DMFurColorText
  453. if(DMDogRace == 290)then
  454. DMFurColorText = "Schwarz"
  455. elseif(DMDogRace == 291)then
  456. DMFurColorText = "Schwarz & Weiß"
  457. elseif(DMDogRace == 292)then
  458. DMFurColorText = "Schwarz & Braun"
  459. elseif(DMDogRace == 293)then
  460. DMFurColorText = "Braun"
  461. elseif(DMDogRace == 294)then
  462. DMFurColorText = "Weiß"
  463. elseif(DMDogRace == 295)then
  464. DMFurColorText = "Grau"
  465. elseif(DMDogRace == 296)then
  466. DMFurColorText = "Schwarz & Weiß"
  467. elseif(DMDogRace == 297)then
  468. DMFurColorText = "Braun"
  469. elseif(DMDogRace == 298)then
  470. DMFurColorText = "Weiß"
  471. elseif(DMDogRace == 299)then
  472. DMFurColorText = "Schwarz & Braun"
  473. end
  474. dxDrawText(DMFurColorText, 0.789 * DMScreenx, 0.541 * DMScreeny, 0.9412 * DMScreenx, 0.589 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  475.  
  476. dxDrawText("Geschlecht", 0.785 * DMScreenx, 0.61 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  477. dxDrawImage(0.82 * DMScreenx, 0.625 * DMScreeny, 40 * DMImagex, 35 * DMImagey, texture7  )
  478. dxDrawImage(0.88 * DMScreenx, 0.625 * DMScreeny, 45 * DMImagex, 40 * DMImagey, texture8  )
  479.  
  480. dxDrawImage(0.9 * DMScreenx, 0.67 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  481. dxDrawText("Fertig", 0.9 * DMScreenx, 0.675 * DMScreeny, DMScreenx * 0.943, DMScreeny * 0.713, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  482. end
  483. end
  484.  
  485. function DMDogCreationInteractives()
  486. DMDogNameEdit = guiCreateEdit ( 0.79 * DMScreenx, 0.365 * DMScreeny, 0.15 * DMScreenx, 0.04 * DMScreeny, "", false)
  487. guiSetAlpha(DMDogNameEdit, 0.8)
  488. guiSetVisible(DMDogNameEdit, false)
  489. guiEditSetMaxLength ( DMDogNameEdit, 12)
  490.  
  491. DMDogNameButton1 = guiCreateButton ( 0.789 * DMScreenx, 0.45 * DMScreeny, 0.02 * DMScreenx, 0.05 * DMScreeny, "<", false)
  492. DMDogNameButton2 = guiCreateButton ( 0.922 * DMScreenx, 0.45 * DMScreeny, 0.02 * DMScreenx, 0.05 * DMScreeny, ">", false)
  493. guiSetVisible(DMDogNameButton1, false)
  494. guiSetVisible(DMDogNameButton2, false)
  495. guiSetAlpha(DMDogNameButton1, 0)
  496. guiSetAlpha(DMDogNameButton2, 0)
  497.  
  498. DMDogNameButton3 = guiCreateButton ( 0.789 * DMScreenx, 0.54 * DMScreeny, 0.02 * DMScreenx, 0.05 * DMScreeny, "<", false)
  499. DMDogNameButton4 = guiCreateButton ( 0.922 * DMScreenx, 0.54 * DMScreeny, 0.02 * DMScreenx, 0.05 * DMScreeny, ">", false)
  500. guiSetVisible(DMDogNameButton3, false)
  501. guiSetVisible(DMDogNameButton4, false)
  502. guiSetAlpha(DMDogNameButton3, 0)
  503. guiSetAlpha(DMDogNameButton4, 0)
  504.  
  505. DMDogNameButton6 = guiCreateButton ( 0.82 * DMScreenx, 0.625 * DMScreeny, 0.025 * DMScreenx, 0.035 * DMScreeny, "M", false)
  506. DMDogNameButton7 = guiCreateButton ( 0.88 * DMScreenx, 0.625 * DMScreeny, 0.025 * DMScreenx, 0.035 * DMScreeny, "W", false)
  507. guiSetVisible(DMDogNameButton6, false)
  508. guiSetVisible(DMDogNameButton7, false)
  509. guiSetAlpha(DMDogNameButton6, 0)
  510. guiSetAlpha(DMDogNameButton7, 0)
  511.  
  512. DMDogNameButton5 = guiCreateButton ( 0.9 * DMScreenx, 0.67 * DMScreeny, 0.043 * DMScreenx, 0.043 * DMScreeny, "Done", false)
  513. guiSetVisible(DMDogNameButton5, false)
  514. guiSetAlpha(DMDogNameButton5, 0)
  515.  
  516. addEventHandler ( "onClientGUIClick", DMDogNameButton5, DMCreateDogDone, false )
  517. addEventHandler ( "onClientGUIClick", DMDogNameButton1, DMDogCreationRaceLeft, false )
  518. addEventHandler ( "onClientGUIClick", DMDogNameButton2, DMDogCreationRaceRight, false )
  519. addEventHandler ( "onClientGUIClick", DMDogNameButton3, DMDogCreationSizeLeft, false )
  520. addEventHandler ( "onClientGUIClick", DMDogNameButton4, DMDogCreationSizeRight, false )
  521. addEventHandler ( "onClientGUIClick", DMDogNameButton6, DMDogCreationGender, false )
  522. addEventHandler ( "onClientGUIClick", DMDogNameButton7, DMDogCreationGender, false )
  523. end
  524.  
  525. function DMCreateDogDone()
  526. local DMDogName = guiGetText(DMDogNameEdit)
  527. local DMNameLenght = string.len (DMDogName)
  528.  
  529. if(DMNameLenght < 3)then
  530. if(DMLanguage == 1)then
  531. outputChatBox("Имя короткое", 255,0,0)
  532. elseif(DMLanguage == 2)then
  533. outputChatBox("Слишком короткое имя", 255,0,0)
  534. end
  535.  
  536. else
  537. local player = getLocalPlayer()
  538. setElementFrozen ( player, false)
  539.  
  540. guiSetInputEnabled(false)
  541. showCursor(false)
  542. removeEventHandler("onClientRender", getRootElement(), DMDogCreationGui)
  543. guiSetVisible(DMDogNameEdit, false)
  544. guiSetVisible(DMDogNameButton1, false)
  545. guiSetVisible(DMDogNameButton2, false)
  546. guiSetVisible(DMDogNameButton3, false)
  547. guiSetVisible(DMDogNameButton4, false)
  548. guiSetVisible(DMDogNameButton5, false)
  549. guiSetVisible(DMDogNameButton6, false)
  550. guiSetVisible(DMDogNameButton7, false)
  551.  
  552. triggerServerEvent("DMCreateDogSubmit", getRootElement(), DMDogRace, DMDogName, DMPlayerx, DMPlayery, DMPlayerz, DMPlayerSkin, DMDogCreationGender)
  553. triggerServerEvent("DMCheckOwner", getRootElement())
  554. DMCreatorActive = false
  555. end
  556. end
  557.  
  558.  
  559. --DOG PANEL
  560. function DMDogPanelGui()
  561. if(DMLanguage == 1)then
  562. if(DMClientOwnerGotDog == true)then
  563. if(DMDogDeathRevive == false)then
  564. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  565. dxDrawText("Dog Panel", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  566. dxDrawText("Ваша собака мертва!", 0.78 * DMScreenx, 0.37 * DMScreeny, 0.95 * DMScreenx, 0.37 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  567. dxDrawText("Возродить в "..(180 - DMDogDeathTimerCount).." secs", 0.78 * DMScreenx, 0.395 * DMScreeny,0.95 * DMScreenx, 0.395 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex * 1.2, DMTextSizey * 1.2, "default-bold", "center", "center")
  568. elseif(DMDogDeathRevive == true)then
  569. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  570. dxDrawText("Dog Panel", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  571. dxDrawText("?", 0.94 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex * 1.3, DMTextSizey * 1.3, "default-bold", "left", "center")
  572.  
  573. dxDrawLine(0.78 *DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  574. dxDrawLine(0.78 *DMScreenx, 0.39 * DMScreeny, 0.95 * DMScreenx, 0.39 * DMScreeny, tocolor(255, 255, 255, 220))
  575. dxDrawText(DMClientDogName, 0.79 * DMScreenx, 0.335 * DMScreeny, 0.941 * DMScreenx, 0.385 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex * 1.3, DMTextSizey * 1.3 , "pricedown", "center", "center")
  576.  
  577. local DMHealth = DMRound(DMClientDogFitness, 1)
  578. dxDrawText("Статистика:", 0.785 * DMScreenx, 0.42 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  579. if(DMClientDogGender == "male")then
  580. dxDrawText("Уровень:  #33CCFF"..DMHealth.."#FFFFFF / 100", 0.79 * DMScreenx, 0.445 * DMScreeny, nil, nil, tocolor(255, 225, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center",nil,nil,nil,true)
  581. elseif(DMClientDogGender == "female")then
  582. dxDrawText("Уровень:  #FF33CC"..DMHealth.."#FFFFFF / 100", 0.79 * DMScreenx, 0.445 * DMScreeny, nil, nil, tocolor(255, 225, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center",nil,nil,nil,true)
  583. end
  584. if(DMClientDogGender == "male")then
  585. dxDrawText("Прочность:  #33CCFF"..DMClientDogStrength.."#FFFFFF / 100", 0.79 * DMScreenx, 0.465 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center",nil,nil,nil,true)
  586. elseif(DMClientDogGender == "female")then
  587. dxDrawText("Прочность:  #FF33CC"..DMClientDogStrength.."#FFFFFF / 100", 0.79 * DMScreenx, 0.465 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center",nil,nil,nil,true)
  588. end
  589.  
  590. dxDrawText("Инвентарь:", 0.785 * DMScreenx, 0.505 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  591. dxDrawText("Мяч", 0.79 * DMScreenx, 0.53 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  592. dxDrawText("Собачья еда", 0.79 * DMScreenx, 0.55 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  593.  
  594. if(DMDogSpawned == true and DMPlayerInFight == false)then
  595. if(DMClientDogGender == "male")then
  596. dxDrawRectangle(0.92 * DMScreenx, 0.52 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, tocolor( DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 255))
  597. elseif(DMClientDogGender == "female")then
  598. dxDrawRectangle(0.92 * DMScreenx, 0.52 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, tocolor( DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 255))
  599. end
  600. else
  601. if(DMClientDogGender == "male")then
  602. dxDrawRectangle(0.92 * DMScreenx, 0.52 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, tocolor( 83, 154, 172, 255))
  603. elseif(DMClientDogGender == "female")then
  604. dxDrawRectangle(0.92 * DMScreenx, 0.52 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, tocolor( 172, 83, 154, 255))
  605. end
  606. end
  607. if(DMDogSpawned == true and DMFeedActive == 0 and DMPlayerInFight == false)then
  608. if(DMClientDogGender == "male")then
  609. dxDrawRectangle(0.92 * DMScreenx, 0.54 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, tocolor( DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 255))
  610. elseif(DMClientDogGender == "female")then
  611. dxDrawRectangle(0.92 * DMScreenx, 0.54 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, tocolor( DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 255))
  612. end
  613. else
  614. if(DMClientDogGender == "male")then
  615. dxDrawRectangle(0.92 * DMScreenx, 0.54 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, tocolor(83, 154, 172, 255))
  616. elseif(DMClientDogGender == "female")then
  617. dxDrawRectangle(0.92 * DMScreenx, 0.54 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, tocolor(172, 83, 154, 255))
  618. end
  619. end
  620.  
  621. dxDrawText("Use", 0.92 * DMScreenx, 0.52 * DMScreeny, 0.941 * DMScreenx, 0.535 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  622. dxDrawText("Use", 0.92 * DMScreenx, 0.54 * DMScreeny, 0.941 * DMScreenx, 0.555 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  623.  
  624. dxDrawImage(0.791 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  625. if(DMDogSpawned == true and DMPlayerInFight == false)then
  626. dxDrawImage(0.844 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  627. else
  628. dxDrawImage(0.844 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture6  )
  629. end
  630. if(DMDogSpawned == true and DMPlayerInFight == false)then
  631. dxDrawImage(0.897 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  632. else
  633. dxDrawImage(0.897 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture6  )
  634. end
  635.  
  636. local DMSpawnText
  637. if(DMDogSpawned == false)then
  638. DMSpawnText = "Призвать"
  639. elseif(DMDogSpawned == true)then
  640. DMSpawnText = "Отозвать"
  641. end
  642. dxDrawText(DMSpawnText, 0.791 * DMScreenx, 0.613 * DMScreeny, DMScreenx * 0.833, DMScreeny * 0.653, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  643. dxDrawText("Задачи", 0.844 * DMScreenx, 0.613 * DMScreeny, DMScreenx * 0.885, DMScreeny * 0.653, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  644. dxDrawText("Трюки", 0.897 * DMScreenx, 0.613 * DMScreeny, DMScreenx * 0.939, DMScreeny * 0.653, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  645. end
  646.  
  647. elseif(DMClientOwnerGotDog == false)then
  648. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(25, 25, 25, 220))
  649. dxDrawText("Dog Panel", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(51, 204, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  650. dxDrawText("У тебя нет собаки", 0.78 * DMScreenx, 0.37 * DMScreeny, 0.95 * DMScreenx, 0.37 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  651. dxDrawText("Создать один, используя /dog", 0.78 * DMScreenx, 0.395 * DMScreeny,0.95 * DMScreenx, 0.395 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex * 1.2, DMTextSizey * 1.2, "default-bold", "center", "center")
  652. end
  653. elseif(DMLanguage == 2)then
  654. if(DMClientOwnerGotDog == true)then
  655. if(DMDogDeathRevive == false)then
  656. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  657. dxDrawText("Hunde Panel", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  658. dxDrawText("Твоя собака мертва", 0.78 * DMScreenx, 0.37 * DMScreeny, 0.95 * DMScreenx, 0.37 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  659. dxDrawText("Оживление в "..(180 - DMDogDeathTimerCount).." secs", 0.78 * DMScreenx, 0.395 * DMScreeny,0.95 * DMScreenx, 0.395 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex * 1.2, DMTextSizey * 1.2, "default-bold", "center", "center")
  660. elseif(DMDogDeathRevive == true)then
  661. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  662. dxDrawText("Hundel Panel", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  663. dxDrawText("?", 0.94 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex * 1.3, DMTextSizey * 1.3, "default-bold", "left", "center")
  664.  
  665. dxDrawLine(0.78 *DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  666. dxDrawLine(0.78 *DMScreenx, 0.39 * DMScreeny, 0.95 * DMScreenx, 0.39 * DMScreeny, tocolor(255, 255, 255, 220))
  667. dxDrawText(DMClientDogName, 0.79 * DMScreenx, 0.335 * DMScreeny, 0.941 * DMScreenx, 0.385 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex * 1.3, DMTextSizey * 1.3 , "pricedown", "center", "center")
  668.  
  669. local DMHealth = DMRound(DMClientDogFitness, 1)
  670. dxDrawText("Статистика:", 0.785 * DMScreenx, 0.42 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  671. if(DMClientDogGender == "male")then
  672. dxDrawText("Уровень:  #33CCFF"..DMHealth.."#FFFFFF / 100", 0.79 * DMScreenx, 0.445 * DMScreeny, nil, nil, tocolor(255, 225, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center",nil,nil,nil,true)
  673. elseif(DMClientDogGender == "female")then
  674. dxDrawText("Уровень:  #FF33CC"..DMHealth.."#FFFFFF / 100", 0.79 * DMScreenx, 0.445 * DMScreeny, nil, nil, tocolor(255, 225, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center",nil,nil,nil,true)
  675. end
  676. if(DMClientDogGender == "male")then
  677. dxDrawText("Сила:  #33CCFF"..DMClientDogStrength.."#FFFFFF / 100", 0.79 * DMScreenx, 0.465 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center",nil,nil,nil,true)
  678. elseif(DMClientDogGender == "female")then
  679. dxDrawText("Сила:  #FF33CC"..DMClientDogStrength.."#FFFFFF / 100", 0.79 * DMScreenx, 0.465 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center",nil,nil,nil,true)
  680. end
  681.  
  682. dxDrawText("Инвентарь:", 0.785 * DMScreenx, 0.505 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  683. dxDrawText("Ball", 0.79 * DMScreenx, 0.53 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  684. dxDrawText("Корм для собак", 0.79 * DMScreenx, 0.55 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  685.  
  686. if(DMDogSpawned == true and DMPlayerInFight == false)then
  687. if(DMClientDogGender == "male")then
  688. dxDrawRectangle(0.915 * DMScreenx, 0.52 * DMScreeny, 0.03 * DMScreenx, 0.015 * DMScreeny, tocolor( DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 255))
  689. elseif(DMClientDogGender == "female")then
  690. dxDrawRectangle(0.915 * DMScreenx, 0.52 * DMScreeny, 0.03 * DMScreenx, 0.015 * DMScreeny, tocolor( DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 255))
  691. end
  692. else
  693. if(DMClientDogGender == "male")then
  694. dxDrawRectangle(0.915 * DMScreenx, 0.52 * DMScreeny, 0.03 * DMScreenx, 0.015 * DMScreeny, tocolor( 83, 154, 172, 255))
  695. elseif(DMClientDogGender == "female")then
  696. dxDrawRectangle(0.915 * DMScreenx, 0.52 * DMScreeny, 0.03 * DMScreenx, 0.015 * DMScreeny, tocolor( 172, 83, 154, 255))
  697. end
  698. end
  699. if(DMDogSpawned == true and DMFeedActive == 0 and DMPlayerInFight == false)then
  700. if(DMClientDogGender == "male")then
  701. dxDrawRectangle(0.915 * DMScreenx, 0.54 * DMScreeny, 0.03 * DMScreenx, 0.015 * DMScreeny, tocolor( DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 255))
  702. elseif(DMClientDogGender == "female")then
  703. dxDrawRectangle(0.915 * DMScreenx, 0.54 * DMScreeny, 0.03 * DMScreenx, 0.015 * DMScreeny, tocolor( DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 255))
  704. end
  705. else
  706. if(DMClientDogGender == "male")then
  707. dxDrawRectangle(0.915 * DMScreenx, 0.54 * DMScreeny, 0.03 * DMScreenx, 0.015 * DMScreeny, tocolor(83, 154, 172, 255))
  708. elseif(DMClientDogGender == "female")then
  709. dxDrawRectangle(0.915 * DMScreenx, 0.54 * DMScreeny, 0.03 * DMScreenx, 0.015 * DMScreeny, tocolor(172, 83, 154, 255))
  710. end
  711. end
  712.  
  713. dxDrawText("Benutzen", 0.92 * DMScreenx, 0.52 * DMScreeny, 0.941 * DMScreenx, 0.535 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  714. dxDrawText("Benutzen", 0.92 * DMScreenx, 0.54 * DMScreeny, 0.941 * DMScreenx, 0.555 * DMScreeny, tocolor(0, 0, 0, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  715.  
  716. dxDrawImage(0.791 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  717. if(DMDogSpawned == true and DMPlayerInFight == false)then
  718. dxDrawImage(0.844 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  719. else
  720. dxDrawImage(0.844 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture6  )
  721. end
  722. if(DMDogSpawned == true and DMPlayerInFight == false)then
  723. dxDrawImage(0.897 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  724. else
  725. dxDrawImage(0.897 * DMScreenx, 0.61 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture6  )
  726. end
  727.  
  728. local DMSpawnText
  729. if(DMDogSpawned == false)then
  730. DMSpawnText = "Spawn"
  731. elseif(DMDogSpawned == true)then
  732. DMSpawnText = "Despawn"
  733. end
  734. dxDrawText(DMSpawnText, 0.791 * DMScreenx, 0.613 * DMScreeny, DMScreenx * 0.833, DMScreeny * 0.653, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  735. dxDrawText("Aufgaben", 0.844 * DMScreenx, 0.613 * DMScreeny, DMScreenx * 0.885, DMScreeny * 0.653, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  736. dxDrawText("Tricks", 0.897 * DMScreenx, 0.613 * DMScreeny, DMScreenx * 0.939, DMScreeny * 0.653, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  737. end
  738.  
  739. elseif(DMClientOwnerGotDog == false)then
  740. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(25, 25, 25, 220))
  741. dxDrawText("Hunde Panel", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(51, 204, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  742. dxDrawText("У тебя нет собаки", 0.78 * DMScreenx, 0.37 * DMScreeny, 0.95 * DMScreenx, 0.37 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  743. dxDrawText("Создать собаку /dog", 0.78 * DMScreenx, 0.395 * DMScreeny,0.95 * DMScreenx, 0.395 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex * 1.2, DMTextSizey * 1.2, "default-bold", "center", "center")
  744. end
  745. end
  746. end
  747.  
  748. function DMDogPanel()
  749. if(isPedInVehicle(getLocalPlayer()) == false)then
  750. if(DMDogPanel == false and DMTricksDogPanel == false and DMTricksTutorialActive == false and DMDogPanel == false and DMHelpActive == false and DMCreatorActive == false and DMDogTasksPanel == false and DMDogFightPanel == false and DMDogFightRequestPanel == false and DMDogSniffPanel == false)then
  751.  
  752. if(DMFeedActive == 1)then
  753. DMFeedDogExit()
  754. DMStopFeedAnimation = true
  755. triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  756. DMFeedActive = 0
  757. elseif(DMFeedActive == 2)then
  758. killTimer(DMDogEatTimer)
  759. DMFeedDogExit()
  760. DMStopFeedAnimation = false
  761. triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  762. DMFeedActive = 0
  763. end
  764.  
  765. if(DMBallThrowActive == 1)then
  766. destroyElement(DMBall)
  767. removeEventHandler("onClientPreRender",getRootElement(),DMkeepInHand)
  768. removeEventHandler("onClientKey",getRootElement(),DMthrowBall)
  769. removeEventHandler("onClientPlayerWeaponSwitch", getRootElement(),DMballWeaponSwitch)
  770. DMInventoryBallExit()
  771. elseif(DMBallThrowActive == 2)then
  772. killTimer(DMInventoryGetBallTimer)
  773. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  774. destroyElement(DMBall)
  775. removeEventHandler("onClientRender",getRootElement(),DMthrowedBall)
  776. DMInventoryBallExit()
  777. elseif(DMBallThrowActive == 3)then
  778. killTimer(DMGotBallTimer)
  779. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  780. DMInventoryBallExit()
  781. end
  782.  
  783. if(DMDogGuardActive == 1 or DMDogGuardActive == 2 or DMDogGuardActive == 3)then
  784. DMDogGuardExit()
  785. end
  786.  
  787. if(removeEventHandler("onClientRender", getRootElement(), DMStatusGui))then
  788. DMStatusGuiWasOn = true
  789. DMStatusActive = false
  790. else
  791. DMStatusGuiWasOn = false
  792. end
  793.  
  794. addEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  795. DMDogPanel = true
  796.  
  797. if(DMClientOwnerGotDog == true)then
  798. if(DMDogDeathRevive == true)then
  799. guiSetVisible(DMDogPanelButton1, true)
  800. guiSetVisible(DMDogPanelButton2, true)
  801. guiSetVisible(DMDogPanelButton3, true)
  802. guiSetVisible(DMDogPanelButton4, true)
  803. guiSetVisible(DMDogPanelButton5, true)
  804. guiSetVisible(DMDogPanelButton6, true)
  805. guiSetVisible(DMDogPanelButton7, true)
  806. end
  807. end
  808. showCursor(true)
  809. guiSetInputEnabled(true)
  810. else
  811. local DMStopDog = false
  812. DMExit(DMStopDog)
  813.  
  814. if(DMRequestClose == true)then
  815. DMPlayerInFight = false
  816. DMRequestClose = false
  817. end
  818. if(DMStatusGuiWasOn == true)then
  819. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  820. DMStatusActive = true
  821. end
  822. end
  823. end
  824. end
  825.  
  826. function DMDogPanelInteractives()
  827. DMDogPanelButton1 = guiCreateButton ( 0.791 * DMScreenx, 0.613 * DMScreeny, 0.042 * DMScreenx, 0.04 * DMScreeny, "", false)
  828. DMDogPanelButton2 = guiCreateButton ( 0.844 * DMScreenx, 0.613 * DMScreeny, 0.042 * DMScreenx, 0.04 * DMScreeny, "", false)
  829. DMDogPanelButton3 = guiCreateButton ( 0.897 * DMScreenx, 0.613 * DMScreeny, 0.042 * DMScreenx, 0.04 * DMScreeny, "", false)
  830.  
  831. DMDogPanelButton4 = guiCreateButton ( 0.92 * DMScreenx, 0.52 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, "", false)
  832. DMDogPanelButton5 = guiCreateButton ( 0.92 * DMScreenx, 0.54 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, "", false)
  833. DMDogPanelButton6 = guiCreateButton ( 0.92 * DMScreenx, 0.56 * DMScreeny, 0.021 * DMScreenx, 0.015 * DMScreeny, "", false)
  834.  
  835. DMDogPanelButton7 = guiCreateButton ( 0.935 * DMScreenx, 0.3 * DMScreeny, 0.015 * DMScreenx, 0.025 * DMScreeny, "", false)
  836. guiSetAlpha(DMDogPanelButton1, 0)
  837. guiSetAlpha(DMDogPanelButton2, 0)
  838. guiSetAlpha(DMDogPanelButton3, 0)
  839. guiSetAlpha(DMDogPanelButton4, 0)
  840. guiSetAlpha(DMDogPanelButton5, 0)
  841. guiSetAlpha(DMDogPanelButton6, 0)
  842. guiSetAlpha(DMDogPanelButton7, 0)
  843. guiSetVisible(DMDogPanelButton1, false)
  844. guiSetVisible(DMDogPanelButton2, false)
  845. guiSetVisible(DMDogPanelButton3, false)
  846. guiSetVisible(DMDogPanelButton4, false)
  847. guiSetVisible(DMDogPanelButton5, false)
  848. guiSetVisible(DMDogPanelButton6, false)
  849. guiSetVisible(DMDogPanelButton7, false)
  850.  
  851. addEventHandler ( "onClientGUIClick", DMDogPanelButton1, DMSpawnDog, false )
  852. addEventHandler ( "onClientGUIClick", DMDogPanelButton2, DMDogTasks, false )
  853. addEventHandler ( "onClientGUIClick", DMDogPanelButton3, DMTricksDog, false )
  854. addEventHandler ( "onClientGUIClick", DMDogPanelButton4, DMInverntoryBall, false )
  855. addEventHandler ( "onClientGUIClick", DMDogPanelButton5, DMFeedDog, false )
  856. --addEventHandler ( "onClientGUIClick", DMDogPanelButton6, "", false )
  857. addEventHandler ( "onClientGUIClick", DMDogPanelButton7, DMHelp, false )
  858. end
  859.  
  860.  
  861. --SPAWN
  862. function DMSpawnDog()
  863. if(DMDogSpawned == false)then
  864. local DMStopDog = false
  865. DMExit(DMStopDog)
  866. triggerServerEvent("DMSpawnDog", getRootElement(), DMClientDogRace, DMClientDogFitness)
  867. DMDogSpawned = true
  868. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  869.  
  870. elseif(DMDogSpawned == true)then
  871. local DMStopDog = true
  872. DMExit(DMStopDog)
  873.  
  874. if(DMPlayerInFight == true)then
  875. if(DMLanguage == 1)then
  876. outputChatBox("Ты бросил бой", 255,255,0)
  877. elseif(DMLanguage == 2)then
  878. outputChatBox("Ты бросил бой", 255,255,0)
  879. end
  880.  
  881.  
  882. local DMTriggerPlayer = getPlayerFromName(DMRequestPlayer)
  883. triggerServerEvent("DMDogsFightGiveUp", getRootElement(), DMTriggerPlayer)
  884. DMPlayerInFight = false
  885. end
  886.  
  887. unbindKey(DoTrickKey,"down", DMDoTrick)
  888. unbindKey(ChangeStatusKey,"down", DMChangeDogStatus)
  889. end
  890. end
  891.  
  892. function DMSpawnDogBack(DMDog)
  893. DMClientDog = DMDog
  894. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  895. if(DMOnlySpawn == false)then
  896. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  897. DMDogIdleTimer = setTimer(function()
  898. destroyElement(DMDogIdleBlip)
  899. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  900. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  901.  
  902. local block, anim = getPedAnimation ( DMClientDog )
  903. if(anim ~= "OFF_Sit_Crash")then
  904. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  905. end
  906. end, 5000, 0)
  907. DMDogStatus = 1
  908.  
  909. bindKey(ChangeStatusKey,"down", DMChangeDogStatus)
  910. elseif(DMOnlySpawn == true)then
  911. DMOnlySpawn = false
  912. end
  913.  
  914. DMStatusActive = true
  915.  
  916. DMDogHungerTimer = setTimer(function()
  917.   if(DMDogHunger == 0)then
  918.    local DMNewHealth = (getElementHealth(DMClientDog) - 5)
  919.    triggerServerEvent("DMDogWasted", getRootElement(), DMClientDog, DMNewHealth)
  920.    if(DMNewHealth <= 0)then
  921.      local DMStopDog = true
  922.     DMExit(DMStopDog)
  923.     DMDogRevive()
  924.    end
  925.   else
  926.     DMDogHunger = DMDogHunger - 1
  927.   end
  928. end, 6000, 0)
  929.  
  930. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  931. bindKey(DoTrickKey,"down", DMDoTrick)
  932. bindKey("G","down", function()
  933. Bone = Bone + 1
  934. end)
  935. Bone = 0
  936. Test = createObject(1247,1,1,1)
  937. setElementCollisionsEnabled (Test, false)
  938. addEventHandler("onClientPreRender", getRootElement(), DMTest )
  939. end
  940.  
  941. function DMTest() -- тут я бил
  942. --local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  943. --local DMx, DMy, DMz = getElementPosition(getLocalPlayer())
  944. --dxDrawImage3D(Dogx,Dogy, Dogz - 1, 1, 1, texture1, tocolor(255,255,255,255), nil, Dogx + 50, Dogy,Dogz)
  945. end
  946.  
  947.  
  948. --STATUS
  949. function DMStatusGui()
  950. if(DMLanguage == 1)then
  951. dxDrawRectangle(0.80 * DMScreenx, 0.3 * DMScreeny, 0.15 * DMScreenx, 0.18 * DMScreeny, tocolor(25, 25, 25, 220))
  952.  
  953. if(DMClientDogRace == 290 or DMClientDogRace == 291 or DMClientDogRace == 292)then
  954. dxDrawImage(0.805 * DMScreenx, 0.31 * DMScreeny, 70 * DMImagex, 70 * DMImagey, texture1  )
  955. elseif(DMClientDogRace == 293 or DMClientDogRace == 294 or DMClientDogRace == 295 or DMClientDogRace == 296)then
  956. dxDrawImage(0.805 * DMScreenx, 0.31 * DMScreeny, 70 * DMImagex, 70 * DMImagey, texture2  )
  957. elseif(DMClientDogRace == 297 or DMClientDogRace == 298)then
  958. dxDrawImage(0.805 * DMScreenx, 0.31 * DMScreeny, 70 * DMImagex, 70 * DMImagey, texture3  )
  959. elseif(DMClientDogRace == 299)then
  960. dxDrawImage(0.805 * DMScreenx, 0.31 * DMScreeny, 70 * DMImagex, 70 * DMImagey, texture4  )
  961. end
  962.  
  963. dxDrawText("Имя: ", 0.85 * DMScreenx, 0.32 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  964. dxDrawText(DMClientDogName, 0.85 * DMScreenx, 0.345 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  965.  
  966. dxDrawText("Здоровье: ", 0.805 * DMScreenx, 0.39 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  967.  
  968. local DMDogHealth = getElementHealth(DMClientDog)
  969. local DMDogHealthBar = DMDogHealth * 0.0014 + 0.805
  970.  
  971. dxDrawLine(0.805 *DMScreenx, 0.40 * DMScreeny, 0.945 * DMScreenx, 0.4 * DMScreeny, tocolor(255,255,255, 220), 5)
  972. dxDrawLine(0.805 *DMScreenx, 0.40 * DMScreeny, DMDogHealthBar * DMScreenx, 0.4 * DMScreeny, tocolor(0,255,51, 220), 5)
  973.  
  974. local DMDogHungerBar = DMDogHunger * 0.0014 + 0.805
  975. dxDrawText("Голодание: ", 0.805 * DMScreenx, 0.42 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  976. dxDrawLine(0.805 *DMScreenx, 0.43 * DMScreeny, 0.945 * DMScreenx, 0.43 * DMScreeny, tocolor(255,255,255, 220), 5)
  977. dxDrawLine(0.805 *DMScreenx, 0.43 * DMScreeny, DMDogHungerBar * DMScreenx, 0.43 * DMScreeny, tocolor(255,255,51, 220), 5)
  978.  
  979. dxDrawText("Команда: ", 0.805 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  980.  
  981. if(DMDogStatus == 1)then
  982.   dxDrawText("Ждать", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(0, 255, 51, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  983. elseif(DMDogStatus == 2)then
  984.   dxDrawText("Следовать", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(255, 255, 51, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  985. elseif(DMDogStatus == 3)then
  986.   dxDrawText("Атака", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(255, 0, 0, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  987. elseif(DMDogStatus == 4)then
  988.   dxDrawText("Есть", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  989. elseif(DMDogStatus == 5)then
  990.   dxDrawText("Играть", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  991. elseif(DMDogStatus == 6)then
  992.   dxDrawText("Охрана", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  993. elseif(DMDogStatus == 7)then
  994.   dxDrawText("Бой", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  995. end
  996. elseif(DMLanguage == 2)then
  997. dxDrawRectangle(0.80 * DMScreenx, 0.3 * DMScreeny, 0.15 * DMScreenx, 0.18 * DMScreeny, tocolor(25, 25, 25, 220))
  998.  
  999. if(DMClientDogRace == 290 or DMClientDogRace == 291 or DMClientDogRace == 292)then
  1000. dxDrawImage(0.805 * DMScreenx, 0.31 * DMScreeny, 70 * DMImagex, 70 * DMImagey, texture1  )
  1001. elseif(DMClientDogRace == 293 or DMClientDogRace == 294 or DMClientDogRace == 295 or DMClientDogRace == 296)then
  1002. dxDrawImage(0.805 * DMScreenx, 0.31 * DMScreeny, 70 * DMImagex, 70 * DMImagey, texture2  )
  1003. elseif(DMClientDogRace == 297 or DMClientDogRace == 298)then
  1004. dxDrawImage(0.805 * DMScreenx, 0.31 * DMScreeny, 70 * DMImagex, 70 * DMImagey, texture3  )
  1005. elseif(DMClientDogRace == 299)then
  1006. dxDrawImage(0.805 * DMScreenx, 0.31 * DMScreeny, 70 * DMImagex, 70 * DMImagey, texture4  )
  1007. end
  1008.  
  1009. dxDrawText("Имя: ", 0.85 * DMScreenx, 0.32 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1010. dxDrawText(DMClientDogName, 0.85 * DMScreenx, 0.345 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "left", "center")
  1011.  
  1012. dxDrawText("Здоровье: ", 0.805 * DMScreenx, 0.39 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1013. local DMDogHealth = getElementHealth(DMClientDog)
  1014. local DMDogHealthBar = DMDogHealth * 0.0014 + 0.805
  1015. dxDrawLine(0.805 *DMScreenx, 0.40 * DMScreeny, 0.945 * DMScreenx, 0.4 * DMScreeny, tocolor(255,255,255, 220), 5)
  1016. dxDrawLine(0.805 *DMScreenx, 0.40 * DMScreeny, DMDogHealthBar * DMScreenx, 0.4 * DMScreeny, tocolor(0,255,51, 220), 5)
  1017.  
  1018. local DMDogHungerBar = DMDogHunger * 0.0014 + 0.805
  1019. dxDrawText("Голодание: ", 0.805 * DMScreenx, 0.42 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1020. dxDrawLine(0.805 *DMScreenx, 0.43 * DMScreeny, 0.945 * DMScreenx, 0.43 * DMScreeny, tocolor(255,255,255, 220), 5)
  1021. dxDrawLine(0.805 *DMScreenx, 0.43 * DMScreeny, DMDogHungerBar * DMScreenx, 0.43 * DMScreeny, tocolor(255,255,51, 220), 5)
  1022.  
  1023. dxDrawText("Статус: ", 0.805 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1024.  
  1025. if(DMDogStatus == 1)then
  1026.   dxDrawText("Ждать", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(0, 255, 51, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1027. elseif(DMDogStatus == 2)then
  1028.   dxDrawText("Следовать", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(255, 255, 51, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1029. elseif(DMDogStatus == 3)then
  1030.   dxDrawText("Атака", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(255, 0, 0, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1031. elseif(DMDogStatus == 4)then
  1032.   dxDrawText("Есть", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1033. elseif(DMDogStatus == 5)then
  1034.   dxDrawText("Играть", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1035. elseif(DMDogStatus == 6)then
  1036.   dxDrawText("Охрана", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1037. elseif(DMDogStatus == 7)then
  1038.   dxDrawText("Бой", 0.85 * DMScreenx, 0.455 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1039. end
  1040. end
  1041. end
  1042.  
  1043.  
  1044. --ACTIONS
  1045. function DMDogActionFollow()
  1046. local DMPlayerx, DMPlayery, DMPlayerz
  1047. if(DMDogFollow == 1)then
  1048. DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(getLocalPlayer())
  1049. elseif(DMDogFollow == 2)then
  1050. DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(DMBall)
  1051. elseif(DMDogFollow == 3)then
  1052. DMPlayerx = DMClientBowlx
  1053. DMPlayery = DMClientBowly
  1054. elseif(DMDogFollow == 4)then
  1055. DMPlayerx = DogGuardingx
  1056. DMPlayery = DogGuardingy
  1057. end
  1058.  
  1059. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMClientDog)
  1060. local DMDogFinalRotation
  1061. local DMDogDistanceAnimationChange
  1062. local DMDogRescueTeleport
  1063. local DMDogRotation = math.deg(math.atan((DMPlayerx - DMClientDogx) / (DMPlayery - DMClientDogy)))
  1064.  
  1065. if(DMPlayerx > DMClientDogx and DMPlayery > DMClientDogy)then
  1066. DMDogFinalRotation = DMDogRotation
  1067. elseif(DMPlayerx > DMClientDogx and DMPlayery < DMClientDogy)then
  1068. DMDogFinalRotation = 180 + DMDogRotation
  1069. elseif(DMPlayerx < DMClientDogx and DMPlayery < DMClientDogy)then
  1070. DMDogFinalRotation = 180 + DMDogRotation
  1071. elseif(DMPlayerx < DMClientDogx and DMPlayery > DMClientDogy)then
  1072. DMDogFinalRotation = 360 + DMDogRotation
  1073. end
  1074.  
  1075. if(DMDogFinalRotation == nil)then
  1076. DMDogFinalRotation = 0
  1077. end
  1078.  
  1079. local DMDistance = getDistanceBetweenPoints2D (DMPlayerx , DMPlayery, DMClientDogx, DMClientDogy)
  1080.  
  1081. if(DMDistance <= 1.5)then
  1082.   if(DMDogDistanceAnimation ~= 1)then
  1083.   DMDogDistanceAnimation = 1
  1084.   DMDogDistanceAnimationChange = true
  1085.   if( DMDogFollow == 2 and DMInventoryBallOnGround == true)then
  1086.   DMDoggotBall()
  1087.   end
  1088.   elseif(DMDogDistanceAnimation == 1)then
  1089.   DMDogDistanceAnimationChange = false
  1090.   end
  1091. elseif(DMDistance > 1.5 and DMDistance <= 4)then
  1092.   if(DMDogDistanceAnimation ~= 2)then
  1093.   DMDogDistanceAnimation = 2
  1094.   DMDogDistanceAnimationChange = true
  1095.   elseif(DMDogDistanceAnimation == 2)then
  1096.   DMDogDistanceAnimationChange = false
  1097.   end
  1098. elseif(DMDistance > 4 and DMDistance <= 7 )then
  1099.  if(DMDogDistanceAnimation ~= 3)then
  1100.  DMDogDistanceAnimation = 3
  1101.  DMDogDistanceAnimationChange = true
  1102.  elseif(DMDogDistanceAnimation == 3)then
  1103.  DMDogDistanceAnimationChange = false
  1104.  end
  1105. elseif(DMDistance > 7 and DMDistance <= 50)then
  1106.  if(DMDogDistanceAnimation ~= 4)then
  1107.  DMDogDistanceAnimation = 4
  1108.  DMDogDistanceAnimationChange = true
  1109.  elseif(DMDogDistanceAnimation == 4)then
  1110.  DMDogDistanceAnimationChange = false
  1111.  end
  1112. end
  1113.  
  1114. if(DMDistance > 50 )then
  1115.  DMDogRescueTeleport = true
  1116. else
  1117.  DMDogRescueTeleport = false
  1118. end
  1119.  
  1120. triggerServerEvent("DMDogActionFollow", getRootElement(), DMDogFinalRotation, DMDogDistanceAnimation, DMDogDistanceAnimationChange, DMClientDog, DMDogRescueTeleport, DMDogFollow)
  1121. end
  1122.  
  1123. function DMDogActionAttack()
  1124. local DMPlayerx, DMPlayery, DMPlayerz
  1125. local DMAttackPerson
  1126.  
  1127. if(DMDogAttack == 2)then
  1128. DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(DMClientRequestDog)
  1129. DMAttackPerson = DMClientRequestDog
  1130. elseif(DMDogAttack == 1)then
  1131. DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(DMAttacker)
  1132. DMAttackPerson = DMAttacker
  1133. end
  1134. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMClientDog)
  1135. local DMDogFinalRotation
  1136. local DMDogDistanceAnimationChange
  1137. local DMDogRescueTeleport
  1138. local DMStopAttack
  1139.  
  1140. local DMDogRotation = math.deg(math.atan((DMPlayerx - DMClientDogx) / (DMPlayery - DMClientDogy)))
  1141.  
  1142. if(DMPlayerx > DMClientDogx and DMPlayery > DMClientDogy)then
  1143. DMDogFinalRotation = DMDogRotation
  1144. elseif(DMPlayerx > DMClientDogx and DMPlayery < DMClientDogy)then
  1145. DMDogFinalRotation = 180 + DMDogRotation
  1146. elseif(DMPlayerx < DMClientDogx and DMPlayery < DMClientDogy)then
  1147. DMDogFinalRotation = 180 + DMDogRotation
  1148. elseif(DMPlayerx < DMClientDogx and DMPlayery > DMClientDogy)then
  1149. DMDogFinalRotation = 360 + DMDogRotation
  1150. end
  1151.  
  1152. if(DMDogFinalRotation == nil)then
  1153. DMDogFinalRotation = 0
  1154. end
  1155.  
  1156. local DMDistance = getDistanceBetweenPoints2D (DMPlayerx , DMPlayery, DMClientDogx, DMClientDogy)
  1157.  
  1158. if(DMDistance <= 1.5)then
  1159.   if(DMDogDistanceAnimation ~= 1)then
  1160.   DMDogDistanceAnimation = 1
  1161.   DMDogDistanceAnimationChange = true
  1162.   elseif(DMDogDistanceAnimation == 1)then
  1163.   DMDogDistanceAnimationChange = false
  1164.   end
  1165. elseif(DMDistance > 1.5 and DMDistance <= 7 )then
  1166.  if(DMDogDistanceAnimation ~= 2)then
  1167.  DMDogDistanceAnimation = 2
  1168.  DMDogDistanceAnimationChange = true
  1169.  elseif(DMDogDistanceAnimation == 2)then
  1170.  DMDogDistanceAnimationChange = false
  1171.  end
  1172. elseif(DMDistance > 7 and DMDistance <= 50)then
  1173.  if(DMDogDistanceAnimation ~= 3)then
  1174.  DMDogDistanceAnimation = 3
  1175.  DMDogDistanceAnimationChange = true
  1176.  elseif(DMDogDistanceAnimation == 3)then
  1177.  DMDogDistanceAnimationChange = false
  1178.  end
  1179. end
  1180.  
  1181. if(DMDistance > 50 )then
  1182.  DMDogRescueTeleport = true
  1183. else
  1184.  DMDogRescueTeleport = false
  1185. end
  1186.  
  1187. local DMx, DMy, DMz = getElementPosition(getLocalPlayer())
  1188. local DMDistance = getDistanceBetweenPoints2D (DMx , DMy, DMClientDogx, DMClientDogy)
  1189.  
  1190. local DMVolume = 1 - DMDistance/50
  1191. if(DMVolume <= 0)then
  1192. DMVolume = 0
  1193. end
  1194. if(DMDogAttack == 2)then
  1195. setSoundVolume(DMFightSound1, DMVolume)
  1196. setSoundVolume(DMFightSound2, DMVolume)
  1197. end
  1198.  
  1199. if(DMDogAttack == 1)then
  1200. if(DMDistance > 50)then
  1201. DMStopAttack = true
  1202. else
  1203. DMStopAttack = false
  1204. end
  1205. elseif(DMDogAttack == 2)then
  1206. DMStopAttack = false
  1207. end
  1208.  
  1209. DMAttackCount = DMAttackCount + 1
  1210. if(DMAttackCount == 50)then
  1211. DMAttackCount = 0
  1212. end
  1213. triggerServerEvent("DMDogActionAttack", getRootElement(), DMDogFinalRotation, DMDogDistanceAnimation, DMDogDistanceAnimationChange, DMClientDog, DMDogRescueTeleport, DMAttackPerson, DMAttackCount, DMClientDogStrength, DMStopAttack, DMDogAttack)
  1214. end
  1215.  
  1216. function DMCheckAttack(attacker)
  1217. if(source == getLocalPlayer())then
  1218. DMAttacker = attacker
  1219. if(getElementType(attacker) == "player")then
  1220. if(DMClientOwnerGotDog == true and DMDogSpawned == true and DMDogStatus == 3)then
  1221. if(DMDogAttacking == false)then
  1222. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  1223. DMAttackCount = 0
  1224. DMDogAttacking = true
  1225. DMDogAttack = 1
  1226. addEventHandler("onClientRender", getRootElement(), DMDogActionAttack )
  1227. triggerServerEvent("DMCheckAttackAttacker", getRootElement(), DMAttacker)
  1228. DMAttackSound()
  1229. end
  1230. if(DMClientDogStrength == 100)then
  1231. else
  1232. DMClientDogStrength = DMClientDogStrength + 0.5
  1233. triggerServerEvent("DMSaveStatStrength", getRootElement(), DMClientDogStrength)
  1234. end
  1235. else
  1236. DMDogAttacking = false
  1237. local DMClientDog = nil
  1238. triggerServerEvent("DMCheckAttackAttacker", getRootElement(), DMAttacker)
  1239. end
  1240. end
  1241. end
  1242. end
  1243.  
  1244. function DMCheckAttackAttacker(DMVictim)
  1245. if(DMClientOwnerGotDog == true and DMDogSpawned == true and DMDogStatus == 3)then
  1246. DMAttacker = DMVictim
  1247. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  1248. DMAttackCount = 0
  1249. DMDogAttack = 1
  1250. addEventHandler("onClientRender", getRootElement(), DMDogActionAttack )
  1251. DMDogAttacking = true
  1252. DMAttackSound()
  1253.  
  1254. if(DMClientDogStrength == 100)then
  1255. else
  1256. DMClientDogStrength = DMClientDogStrength + 0.5
  1257. triggerServerEvent("DMSaveStatStrength", getRootElement(), DMClientDogStrength)
  1258. end
  1259.  
  1260. end
  1261. end
  1262.  
  1263. function DMDogActionAttackStop()
  1264. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack )
  1265. DMAttackCount = 0
  1266. DMDogAttacking = false
  1267. DMDogFollow = 1
  1268. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  1269. end
  1270.  
  1271. function DMChangeDogStatus() -- 1 waiting, 2 following, 3 attacking
  1272. if(isPedInVehicle(getLocalPlayer()) == false)then
  1273. if(DMDogGuardActive == 1 or DMDogGuardActive == 2 or DMDogGuardActive == 3)then
  1274. DMDogGuardExit()
  1275. else
  1276. DMExitStatus()
  1277. if(DMDogStatus == 1)then
  1278. DMDogStatus = 2
  1279. DMDogDistanceAnimation = 0
  1280. if(DMClientDogFitness < 100)then
  1281. DMDogFitnessTimer = setTimer(function()
  1282.  if(DMClientDogFitness < 100)then
  1283.    DMClientDogFitness = DMClientDogFitness + 0.02
  1284.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  1285.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  1286.   else
  1287.    DMClientDogFitness = 100
  1288.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  1289.    killTimer(DMDogFitnessTimer)
  1290.   end
  1291. end, 15000, 0)
  1292. end
  1293. DMPositionSyncTimer = setTimer(function()
  1294. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  1295. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  1296. end, 1000, 0)
  1297. DMDogFollow = 1
  1298. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  1299.  
  1300. elseif(DMDogStatus == 2)then
  1301. DMDogStatus = 3
  1302. DMDogDistanceAnimation = 0
  1303. if(DMClientDogFitness < 100)then
  1304. DMDogFitnessTimer = setTimer(function()
  1305.  if(DMClientDogFitness < 100)then
  1306.    DMClientDogFitness = DMClientDogFitness + 0.02
  1307.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  1308.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  1309.   else
  1310.    DMClientDogFitness = 100
  1311.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  1312.    killTimer(DMDogFitnessTimer)
  1313.   end
  1314. end, 15000, 0)
  1315. end
  1316. DMPositionSyncTimer = setTimer(function()
  1317. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  1318. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  1319. end, 1000, 0)
  1320. DMDogFollow = 1
  1321. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  1322.  
  1323. DMAttackStatusSound = playSound3D("sounds/dog_growl.mp3", false)
  1324.  
  1325. elseif(DMDogStatus == 3)then
  1326. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  1327. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  1328. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  1329. DMDogStatus = 1
  1330. DMDogIdleTimer = setTimer(function()
  1331. destroyElement(DMDogIdleBlip)
  1332. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  1333. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  1334.  
  1335. local block, anim = getPedAnimation ( DMClientDog )
  1336. if(anim ~= "OFF_Sit_Crash")then
  1337. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  1338. end
  1339. end, 5000, 0)
  1340. end
  1341. end
  1342. end
  1343. end
  1344.  
  1345.  
  1346. --DOG FEED
  1347. function DMFeedDog()
  1348. if(DMDogSpawned == true and DMPlayerInFight == false)then
  1349. if(DMFeedActive == 0)then
  1350. removeEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  1351. DMDogPanel = false
  1352.  
  1353. guiSetVisible(DMDogPanelButton1, false)
  1354. guiSetVisible(DMDogPanelButton2, false)
  1355. guiSetVisible(DMDogPanelButton3, false)
  1356. guiSetVisible(DMDogPanelButton4, false)
  1357. guiSetVisible(DMDogPanelButton5, false)
  1358. guiSetVisible(DMDogPanelButton6, false)
  1359. guiSetVisible(DMDogPanelButton7, false)
  1360.  
  1361. showCursor(false)
  1362.  
  1363. guiSetInputEnabled(false)
  1364. local DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(getLocalPlayer())
  1365. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMClientDog)
  1366. local DMDistance = getDistanceBetweenPoints2D (DMPlayerx , DMPlayery, DMClientDogx, DMClientDogy)
  1367.        
  1368. if(DMDistance < 50)then
  1369. if(DMDogStatus == 1)then
  1370. destroyElement(DMDogIdleBlip)
  1371. killTimer(DMDogIdleTimer)
  1372. DMPositionSyncTimer = setTimer(function()
  1373. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  1374. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  1375. end, 1000, 0)
  1376. elseif(DMDogStatus == 2)then
  1377. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  1378. elseif(DMDogStatus == 3)then
  1379. if(removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow ))then
  1380. else
  1381. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  1382. end
  1383. elseif(DMDogStatus == 7)then
  1384. DMDogAttacking = false
  1385. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  1386. bindKey(ChangeStatusKey, "down", DMChangeDogStatus)
  1387. end
  1388.  
  1389. DMOldDogStatus = DMDogStatus
  1390. DMDogStatus = 4
  1391.  
  1392. if(DMStatusGuiWasOn == true)then
  1393. DMStatusActive = true
  1394. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  1395. end
  1396.  
  1397. triggerServerEvent("DMFeedDog", getRootElement())
  1398.  
  1399. local DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(getLocalPlayer())
  1400. DMClientBowlx = DMPlayerx + 0.5
  1401. DMClientBowly = DMPlayery
  1402. DMDogDistanceAnimation = 0
  1403. DMDogFollow = 3
  1404. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow)
  1405.  
  1406. DMFeedActive = 1
  1407. else
  1408. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  1409. if(DMLanguage == 1)then
  1410. outputChatBox("Собака далеко!",255, 0,0)
  1411. elseif(DMLanguage == 2)then
  1412. outputChatBox("Собака далеко!",255, 0,0)
  1413. end
  1414.  
  1415. end
  1416. end
  1417. end
  1418. end
  1419.  
  1420. function DMFeedDogBack()
  1421. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow)
  1422.  
  1423. DMFeedActive = 2
  1424. local DMDogHealth = getElementHealth(DMClientDog)
  1425. if(DMDogHealth >= 80)then
  1426. setElementHealth(DMClientDog, 100)
  1427. else
  1428. setElementHealth(DMClientDog, DMDogHealth + 20)
  1429. end
  1430. DMDogEatTimer = setTimer(function()
  1431.   if(DMDogHunger < 100)then
  1432.     DMDogHunger = DMDogHunger + 2
  1433.   else
  1434.     DMDogHunger = 100
  1435.     killTimer(DMDogEatTimer)
  1436.     DMFeedActive = 0
  1437.     DMStopFeedAnimation = false
  1438.     triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  1439.     DMFeedDogExit()
  1440.   end
  1441. end, 100, 0)
  1442. end
  1443.  
  1444. function DMFeedDogExit()
  1445. if(DMOldDogStatus == 1)then
  1446. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow)
  1447.     DMDogStatus = 1
  1448.     killTimer(DMPositionSyncTimer)
  1449.     triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  1450.     DMDogIdleTimer = setTimer(function()
  1451.     destroyElement(DMDogIdleBlip)
  1452.     local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  1453.     DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  1454.  
  1455.     local block, anim = getPedAnimation ( DMClientDog )
  1456.     if(anim ~= "OFF_Sit_Crash")then
  1457.     triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  1458.     end
  1459.     end, 5000, 0)
  1460.     elseif(DMOldDogStatus == 2)then
  1461.     DMDogStatus = 2
  1462.     DMDogDistanceAnimation = 0
  1463.     DMDogFollow = 1
  1464.     addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  1465.     elseif(DMOldDogStatus == 3 or DMOldDogStatus == 7)then
  1466.     DMDogStatus = 3
  1467.     DMDogDistanceAnimation = 0
  1468.     DMDogFollow = 1
  1469.     addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  1470.     end
  1471. end
  1472.  
  1473.  
  1474. --DOG TRICKS
  1475. function DMTricksDogGui()
  1476. if(DMLanguage == 1)then
  1477. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  1478. dxDrawText("Dog Tricks", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1479.  
  1480. dxDrawLine(0.78 * DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  1481. dxDrawLine(0.78 * DMScreenx, 0.3785 * DMScreeny, 0.95 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220))
  1482. dxDrawLine(0.78 * DMScreenx, 0.427 * DMScreeny, 0.95 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220))
  1483. dxDrawLine(0.78 * DMScreenx, 0.4755 * DMScreeny, 0.95 * DMScreenx,  0.4755 * DMScreeny, tocolor(255, 255, 255, 220))
  1484. dxDrawLine(0.78 * DMScreenx, 0.524 * DMScreeny, 0.95 * DMScreenx,  0.524 * DMScreeny, tocolor(255, 255, 255, 220))
  1485. dxDrawLine(0.78 * DMScreenx, 0.5725 * DMScreeny, 0.95 * DMScreenx,  0.5725 * DMScreeny, tocolor(255, 255, 255, 220))
  1486. dxDrawLine(0.78 * DMScreenx, 0.621 * DMScreeny, 0.95 * DMScreenx,  0.621 * DMScreeny, tocolor(255, 255, 255, 220))
  1487.  
  1488. if(DMClientDogFitness >= 0)then
  1489. dxDrawText("Sit", 0.785 * DMScreenx, 0.33 * DMScreeny, 0.945 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1490. else
  1491. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.33 * DMScreeny, 0.945 * DMScreenx, 0.3685 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1492. dxDrawText("Уровень 0", 0.785 * DMScreenx, 0.3685 * DMScreeny, 0.945 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1493. dxDrawRectangle(0.78 * DMScreenx, 0.335 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1494. end
  1495. if(DMClientDogFitness >= 5)then
  1496. dxDrawText("Handstand", 0.785 * DMScreenx, 0.3785 * DMScreeny, 0.945 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1497. else
  1498. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.3785 * DMScreeny, 0.945 * DMScreenx, 0.412 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1499. dxDrawText("Уровень 5", 0.785 * DMScreenx, 0.412 * DMScreeny, 0.945 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1500. dxDrawRectangle(0.78 * DMScreenx, 0.3835 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1501. end
  1502. if(DMClientDogFitness >= 15)then
  1503. dxDrawText("Roll", 0.785 * DMScreenx, 0.427 * DMScreeny, 0.945 * DMScreenx, 0.4755 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1504. else
  1505. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.427 * DMScreeny, 0.945 * DMScreenx, 0.4605 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1506. dxDrawText("Уровень 15", 0.785 * DMScreenx, 0.4605 * DMScreeny, 0.945 * DMScreenx, 0.4755 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1507. dxDrawRectangle(0.78 * DMScreenx, 0.432 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1508. end
  1509. if(DMClientDogFitness >= 30)then
  1510. dxDrawText("Jump", 0.785 * DMScreenx, 0.4755 * DMScreeny, 0.945 * DMScreenx, 0.524 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1511. else
  1512. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.4755 * DMScreeny, 0.945 * DMScreenx, 0.509 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1513. dxDrawText("Уровень 30", 0.785 * DMScreenx, 0.509 * DMScreeny, 0.945 * DMScreenx, 0.524 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1514. dxDrawRectangle(0.78 * DMScreenx, 0.4805 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1515. end
  1516. if(DMClientDogFitness >= 50)then
  1517. dxDrawText("Beg", 0.785 * DMScreenx, 0.524 * DMScreeny, 0.945 * DMScreenx, 0.5725 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1518. else
  1519. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.524 * DMScreeny, 0.945 * DMScreenx, 0.5675 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1520. dxDrawText("Уровень 50", 0.785 * DMScreenx, 0.5575 * DMScreeny, 0.945 * DMScreenx, 0.5725 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1521. dxDrawRectangle(0.78 * DMScreenx, 0.529 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1522. end
  1523. if(DMClientDogFitness >= 70)then
  1524. dxDrawText("Ninja Kick", 0.785 * DMScreenx, 0.5725 * DMScreeny, 0.945 * DMScreenx, 0.621 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1525. else
  1526. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.5725 * DMScreeny, 0.945 * DMScreenx, 0.606 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1527. dxDrawText("Уровень 70", 0.785 * DMScreenx, 0.606 * DMScreeny, 0.945 * DMScreenx, 0.621 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1528. dxDrawRectangle(0.78 * DMScreenx, 0.5775 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1529. end
  1530. if(DMClientDogFitness >= 95)then
  1531. dxDrawText("Moonwalk", 0.785 * DMScreenx, 0.621 * DMScreeny, 0.945 * DMScreenx, 0.6695 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1532. else
  1533. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.621 * DMScreeny, 0.945 * DMScreenx, 0.6545 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1534. dxDrawText("Уровень 95", 0.785 * DMScreenx, 0.6545 * DMScreeny, 0.945 * DMScreenx, 0.6695 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1535. dxDrawRectangle(0.78 * DMScreenx, 0.626 * DMScreeny, 0.17 * DMScreenx, 0.044 * DMScreeny, tocolor(20, 20, 20, 100))
  1536. end
  1537. elseif(DMLanguage == 2)then
  1538. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  1539. dxDrawText("Собачьи хитрости", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  1540.  
  1541. dxDrawLine(0.78 * DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  1542. dxDrawLine(0.78 * DMScreenx, 0.3785 * DMScreeny, 0.95 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220))
  1543. dxDrawLine(0.78 * DMScreenx, 0.427 * DMScreeny, 0.95 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220))
  1544. dxDrawLine(0.78 * DMScreenx, 0.4755 * DMScreeny, 0.95 * DMScreenx,  0.4755 * DMScreeny, tocolor(255, 255, 255, 220))
  1545. dxDrawLine(0.78 * DMScreenx, 0.524 * DMScreeny, 0.95 * DMScreenx,  0.524 * DMScreeny, tocolor(255, 255, 255, 220))
  1546. dxDrawLine(0.78 * DMScreenx, 0.5725 * DMScreeny, 0.95 * DMScreenx,  0.5725 * DMScreeny, tocolor(255, 255, 255, 220))
  1547. dxDrawLine(0.78 * DMScreenx, 0.621 * DMScreeny, 0.95 * DMScreenx,  0.621 * DMScreeny, tocolor(255, 255, 255, 220))
  1548.  
  1549. if(DMClientDogFitness >= 0)then
  1550. dxDrawText("Sitz", 0.785 * DMScreenx, 0.33 * DMScreeny, 0.945 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1551. else
  1552. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.33 * DMScreeny, 0.945 * DMScreenx, 0.3685 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1553. dxDrawText("Уровень 0", 0.785 * DMScreenx, 0.3685 * DMScreeny, 0.945 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1554. dxDrawRectangle(0.78 * DMScreenx, 0.335 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1555. end
  1556. if(DMClientDogFitness >= 5)then
  1557. dxDrawText("Handstand", 0.785 * DMScreenx, 0.3785 * DMScreeny, 0.945 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1558. else
  1559. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.3785 * DMScreeny, 0.945 * DMScreenx, 0.412 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1560. dxDrawText("Уровень 5", 0.785 * DMScreenx, 0.412 * DMScreeny, 0.945 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1561. dxDrawRectangle(0.78 * DMScreenx, 0.3835 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1562. end
  1563. if(DMClientDogFitness >= 15)then
  1564. dxDrawText("Roll", 0.785 * DMScreenx, 0.427 * DMScreeny, 0.945 * DMScreenx, 0.4755 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1565. else
  1566. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.427 * DMScreeny, 0.945 * DMScreenx, 0.4605 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1567. dxDrawText("Уровень 15", 0.785 * DMScreenx, 0.4605 * DMScreeny, 0.945 * DMScreenx, 0.4755 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1568. dxDrawRectangle(0.78 * DMScreenx, 0.432 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1569. end
  1570. if(DMClientDogFitness >= 30)then
  1571. dxDrawText("Spring", 0.785 * DMScreenx, 0.4755 * DMScreeny, 0.945 * DMScreenx, 0.524 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1572. else
  1573. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.4755 * DMScreeny, 0.945 * DMScreenx, 0.509 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1574. dxDrawText("Уровень 30", 0.785 * DMScreenx, 0.509 * DMScreeny, 0.945 * DMScreenx, 0.524 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1575. dxDrawRectangle(0.78 * DMScreenx, 0.4805 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1576. end
  1577. if(DMClientDogFitness >= 50)then
  1578. dxDrawText("Betteln", 0.785 * DMScreenx, 0.524 * DMScreeny, 0.945 * DMScreenx, 0.5725 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1579. else
  1580. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.524 * DMScreeny, 0.945 * DMScreenx, 0.5675 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1581. dxDrawText("Уровень 50", 0.785 * DMScreenx, 0.5575 * DMScreeny, 0.945 * DMScreenx, 0.5725 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1582. dxDrawRectangle(0.78 * DMScreenx, 0.529 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1583. end
  1584. if(DMClientDogFitness >= 70)then
  1585. dxDrawText("Ninja Kick", 0.785 * DMScreenx, 0.5725 * DMScreeny, 0.945 * DMScreenx, 0.621 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1586. else
  1587. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.5725 * DMScreeny, 0.945 * DMScreenx, 0.606 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1588. dxDrawText("Уровень 70", 0.785 * DMScreenx, 0.606 * DMScreeny, 0.945 * DMScreenx, 0.621 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1589. dxDrawRectangle(0.78 * DMScreenx, 0.5775 * DMScreeny, 0.17 * DMScreenx, 0.048 * DMScreeny, tocolor(20, 20, 20, 100))
  1590. end
  1591. if(DMClientDogFitness >= 95)then
  1592. dxDrawText("Moonwalk", 0.785 * DMScreenx, 0.621 * DMScreeny, 0.945 * DMScreenx, 0.6695 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1593. else
  1594. dxDrawText("Закрыто", 0.785 * DMScreenx, 0.621 * DMScreeny, 0.945 * DMScreenx, 0.6545 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  1595. dxDrawText("Уровень 95", 0.785 * DMScreenx, 0.6545 * DMScreeny, 0.945 * DMScreenx, 0.6695 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center")
  1596. dxDrawRectangle(0.78 * DMScreenx, 0.626 * DMScreeny, 0.17 * DMScreenx, 0.044 * DMScreeny, tocolor(20, 20, 20, 100))
  1597. end
  1598. end
  1599. end
  1600.  
  1601. function DMTricksDog()
  1602. if(DMDogSpawned == true and DMPlayerInFight == false)then
  1603. removeEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  1604. DMDogPanel = false
  1605.  
  1606. guiSetVisible(DMDogPanelButton1, false)
  1607. guiSetVisible(DMDogPanelButton2, false)
  1608. guiSetVisible(DMDogPanelButton3, false)
  1609. guiSetVisible(DMDogPanelButton4, false)
  1610. guiSetVisible(DMDogPanelButton5, false)
  1611. guiSetVisible(DMDogPanelButton6, false)
  1612. guiSetVisible(DMDogPanelButton7, false)
  1613.  
  1614.  
  1615. addEventHandler("onClientRender", getRootElement(), DMTricksDogGui)
  1616. guiSetVisible(DMTricksDogButton1, true)
  1617. guiSetVisible(DMTricksDogButton2, true)
  1618. guiSetVisible(DMTricksDogButton3, true)
  1619. guiSetVisible(DMTricksDogButton4, true)
  1620. guiSetVisible(DMTricksDogButton5, true)
  1621. guiSetVisible(DMTricksDogButton6, true)
  1622. guiSetVisible(DMTricksDogButton7, true)
  1623. guiSetVisible(DMTricksDogButton8, true)
  1624. DMTricksDogPanel = true
  1625. end
  1626. end
  1627.  
  1628. function DMTricksDogInteractives()
  1629. DMTricksDogButton1 = guiCreateButton ( 0.78 * DMScreenx, 0.33 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  1630. DMTricksDogButton2 = guiCreateButton ( 0.78 * DMScreenx, 0.3785 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  1631. DMTricksDogButton3 = guiCreateButton ( 0.78 * DMScreenx, 0.427 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  1632. DMTricksDogButton4 = guiCreateButton ( 0.78 * DMScreenx, 0.4755 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  1633. DMTricksDogButton5 = guiCreateButton ( 0.78 * DMScreenx, 0.524 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  1634. DMTricksDogButton6 = guiCreateButton ( 0.78 * DMScreenx, 0.5725 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  1635. DMTricksDogButton7 = guiCreateButton ( 0.78 * DMScreenx, 0.621 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  1636.  
  1637.  
  1638. guiSetAlpha(DMTricksDogButton1, 0)
  1639. guiSetAlpha(DMTricksDogButton2, 0)
  1640. guiSetAlpha(DMTricksDogButton3, 0)
  1641. guiSetAlpha(DMTricksDogButton4, 0)
  1642. guiSetAlpha(DMTricksDogButton5, 0)
  1643. guiSetAlpha(DMTricksDogButton6, 0)
  1644. guiSetAlpha(DMTricksDogButton7, 0)
  1645.  
  1646.  
  1647. guiSetVisible(DMTricksDogButton1, false)
  1648. guiSetVisible(DMTricksDogButton2, false)
  1649. guiSetVisible(DMTricksDogButton3, false)
  1650. guiSetVisible(DMTricksDogButton4, false)
  1651. guiSetVisible(DMTricksDogButton5, false)
  1652. guiSetVisible(DMTricksDogButton6, false)
  1653. guiSetVisible(DMTricksDogButton7, false)
  1654.  
  1655.  
  1656. addEventHandler ( "onClientGUIClick", DMTricksDogButton1, DMTricksDogTutorial, false )
  1657. addEventHandler ( "onClientGUIClick", DMTricksDogButton2, DMTricksDogTutorial, false )
  1658. addEventHandler ( "onClientGUIClick", DMTricksDogButton3, DMTricksDogTutorial, false )
  1659. addEventHandler ( "onClientGUIClick", DMTricksDogButton4, DMTricksDogTutorial, false )
  1660. addEventHandler ( "onClientGUIClick", DMTricksDogButton5, DMTricksDogTutorial, false )
  1661. addEventHandler ( "onClientGUIClick", DMTricksDogButton6, DMTricksDogTutorial, false )
  1662. addEventHandler ( "onClientGUIClick", DMTricksDogButton7, DMTricksDogTutorial, false )
  1663. end
  1664.  
  1665. function DMTricksDogTutorialGui()
  1666. if(DMLanguage == 1)then
  1667. if(DMGotCursorPosition == false)then
  1668. dxDrawRectangle(0.45 * DMScreenx, 0.4 * DMScreeny, 0.1 * DMScreenx, 0.2 * DMScreeny, tocolor(20, 20, 20, 220))
  1669. dxDrawText("Это учебник. Если вы хотите, чтобы ваша собака делала трюки во время игры, нажмите K.", 0.45 * DMScreenx, 0.405 * DMScreeny, 0.55 * DMScreenx,  0.5 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center",false, true)
  1670. dxDrawText("Нажмите и удерживайте на экране", 0.45 * DMScreenx, 0.505 * DMScreeny, 0.55 * DMScreenx,  0.6 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center",false, true)
  1671. else
  1672. dxDrawRectangle(0.45 * DMScreenx, 0.45 * DMScreeny, 0.1 * DMScreenx, 0.1 * DMScreeny, tocolor(20, 20, 20, 220))
  1673. if(DMClientDogGender == "male")then
  1674. dxDrawText("Перетащите в синий прямоугольник", 0.45 * DMScreenx, 0.45 * DMScreeny, 0.55 * DMScreenx,  0.55 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  1675. elseif(DMClientDogGender == "female")then
  1676. dxDrawText("Перетащите в синий прямоугольник", 0.45 * DMScreenx, 0.45 * DMScreeny, 0.55 * DMScreenx,  0.55 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  1677. end
  1678.  
  1679. if(DMTrickTutorial == 1)then
  1680. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1681. end
  1682. if(DMTrickTutorial == 2)then
  1683. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1684. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1685. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1686. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1687. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, 0 * DMScreeny, 0.2 * DMScreenx, (DMCursory - 0.4) * DMScreeny, tocolor(0, 0, 0, 200))--!!
  1688. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.4) * DMScreeny, 0.2 * DMScreenx, (1 - DMCursory + 0.2) * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1689. end
  1690. if(DMTrickTutorial == 3)then
  1691. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))--!!
  1692. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1693. end
  1694. if(DMTrickTutorial == 4)then
  1695. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1696. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1697. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1698. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))--!!
  1699. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, 0 * DMScreeny, 0.2 * DMScreenx, (DMCursory - 0.4) * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1700. end
  1701. if(DMTrickTutorial == 5)then
  1702. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1703. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))--!!
  1704. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(51, 204, 255, 240))
  1705. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1706. end
  1707. if(DMTrickTutorial == 7)then
  1708. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1709. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1710. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1711. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1712. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, 0 * DMScreeny, 0.2 * DMScreenx, (DMCursory - 0.4) * DMScreeny, tocolor(0, 0, 0, 200))
  1713. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.4) * DMScreeny, 0.2 * DMScreenx, (1 - DMCursory + 0.2) * DMScreeny, tocolor(0, 0, 0, 200))--!!
  1714. dxDrawRectangle(0 * DMScreenx, 0 * DMScreeny, (DMCursorx - 0.2) * DMScreenx, (DMCursory - 0.2) * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1715. end
  1716. if(DMTrickTutorial == 8)then
  1717. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1718. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1719. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1720. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1721. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, 0 * DMScreeny, 0.2 * DMScreenx, (DMCursory - 0.4) * DMScreeny, tocolor(0, 0, 0, 200))
  1722. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.4) * DMScreeny, 0.2 * DMScreenx, (1 - DMCursory + 0.2) * DMScreeny, tocolor(0, 0, 0, 200))
  1723. dxDrawRectangle(0 * DMScreenx, 0 * DMScreeny, (DMCursorx - 0.2) * DMScreenx, (DMCursory - 0.2) * DMScreeny, tocolor(0, 0, 0, 100))--!!
  1724. dxDrawRectangle(0 * DMScreenx, (DMCursory + 0.4) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, (1 - DMCursory + 0.2) * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1725. end
  1726. end
  1727. elseif(DMLanguage == 2)then
  1728. if(DMGotCursorPosition == false)then
  1729. dxDrawRectangle(0.45 * DMScreenx, 0.4 * DMScreeny, 0.1 * DMScreenx, 0.2 * DMScreeny, tocolor(20, 20, 20, 220))
  1730. dxDrawText("Это руководство. Если вы хотите сделать трюк во время игры, нажмите K.", 0.45 * DMScreenx, 0.405 * DMScreeny, 0.55 * DMScreenx,  0.5 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default", "center", "center",false, true)
  1731. dxDrawText("Нажмите и удерживайте кнопку мыши", 0.45 * DMScreenx, 0.505 * DMScreeny, 0.55 * DMScreenx,  0.6 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center",false, true)
  1732. else
  1733. dxDrawRectangle(0.425 * DMScreenx, 0.45 * DMScreeny, 0.15 * DMScreenx, 0.1 * DMScreeny, tocolor(20, 20, 20, 220))
  1734. if(DMClientDogGender == "male")then
  1735. dxDrawText("Перетащите курсор на синий прямоугольник", 0.45 * DMScreenx, 0.45 * DMScreeny, 0.55 * DMScreenx,  0.55 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  1736. elseif(DMClientDogGender == "female")then
  1737. dxDrawText("Перетащите курсор на синий прямоугольник", 0.45 * DMScreenx, 0.45 * DMScreeny, 0.55 * DMScreenx,  0.55 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "center")
  1738. end
  1739.  
  1740. if(DMTrickTutorial == 1)then
  1741. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1742. end
  1743. if(DMTrickTutorial == 2)then
  1744. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1745. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1746. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1747. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1748. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, 0 * DMScreeny, 0.2 * DMScreenx, (DMCursory - 0.4) * DMScreeny, tocolor(0, 0, 0, 200))--!!
  1749. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.4) * DMScreeny, 0.2 * DMScreenx, (1 - DMCursory + 0.2) * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1750. end
  1751. if(DMTrickTutorial == 3)then
  1752. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))--!!
  1753. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1754. end
  1755. if(DMTrickTutorial == 4)then
  1756. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1757. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1758. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1759. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))--!!
  1760. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, 0 * DMScreeny, 0.2 * DMScreenx, (DMCursory - 0.4) * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1761. end
  1762. if(DMTrickTutorial == 5)then
  1763. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1764. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))--!!
  1765. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(51, 204, 255, 240))
  1766. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1767. end
  1768. if(DMTrickTutorial == 7)then
  1769. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1770. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1771. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1772. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1773. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, 0 * DMScreeny, 0.2 * DMScreenx, (DMCursory - 0.4) * DMScreeny, tocolor(0, 0, 0, 200))
  1774. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.4) * DMScreeny, 0.2 * DMScreenx, (1 - DMCursory + 0.2) * DMScreeny, tocolor(0, 0, 0, 200))--!!
  1775. dxDrawRectangle(0 * DMScreenx, 0 * DMScreeny, (DMCursorx - 0.2) * DMScreenx, (DMCursory - 0.2) * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1776. end
  1777. if(DMTrickTutorial == 8)then
  1778. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.2) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1779. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory - 0.4) * DMScreeny, 0.2 * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1780. dxDrawRectangle(0 * DMScreenx, (DMCursory - 0.1) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1781. dxDrawRectangle((DMCursorx + 0.2) * DMScreenx, (DMCursory - 0.1) * DMScreeny, (1 - DMCursorx - 0.2) * DMScreenx, 0.2 * DMScreeny, tocolor(0, 0, 0, 100))
  1782. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, 0 * DMScreeny, 0.2 * DMScreenx, (DMCursory - 0.4) * DMScreeny, tocolor(0, 0, 0, 200))
  1783. dxDrawRectangle((DMCursorx - 0.1) * DMScreenx, (DMCursory + 0.4) * DMScreeny, 0.2 * DMScreenx, (1 - DMCursory + 0.2) * DMScreeny, tocolor(0, 0, 0, 200))
  1784. dxDrawRectangle(0 * DMScreenx, 0 * DMScreeny, (DMCursorx - 0.2) * DMScreenx, (DMCursory - 0.2) * DMScreeny, tocolor(0, 0, 0, 100))--!!
  1785. dxDrawRectangle(0 * DMScreenx, (DMCursory + 0.4) * DMScreeny, (DMCursorx - 0.2) * DMScreenx, (1 - DMCursory + 0.2) * DMScreeny, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 240))
  1786. end
  1787. end
  1788. end
  1789. end
  1790.  
  1791. function DMTricksDogTutorial()
  1792. DMTrickTutorial = 0
  1793. if(source == DMTricksDogButton1)then
  1794. if(DMClientDogFitness >= 0)then
  1795. DMTrickTutorial = 1
  1796. end
  1797. elseif(source == DMTricksDogButton2)then
  1798. if(DMClientDogFitness >= 5)then
  1799. DMTrickTutorial = 3
  1800. end
  1801. elseif(source == DMTricksDogButton3)then
  1802. if(DMClientDogFitness >= 15)then
  1803. DMTrickTutorial = 5
  1804. end
  1805. elseif(source == DMTricksDogButton4)then
  1806. if(DMClientDogFitness >= 30)then
  1807. DMTrickTutorial = 4
  1808. end
  1809. elseif(source == DMTricksDogButton5)then
  1810. if(DMClientDogFitness >= 50)then
  1811. DMTrickTutorial = 2
  1812. end
  1813. elseif(source == DMTricksDogButton6)then
  1814. if(DMClientDogFitness >= 70)then
  1815. DMTrickTutorial = 7
  1816. end
  1817. elseif(source == DMTricksDogButton7)then
  1818. if(DMClientDogFitness >= 95)then
  1819. DMTrickTutorial = 8
  1820. end
  1821. end
  1822.  
  1823. if(DMTrickTutorial ~= 0)then
  1824. removeEventHandler("onClientRender", getRootElement(), DMTricksDogGui)
  1825. DMTricksDogPanel = false
  1826. guiSetVisible(DMTricksDogButton1, false)
  1827. guiSetVisible(DMTricksDogButton2, false)
  1828. guiSetVisible(DMTricksDogButton3, false)
  1829. guiSetVisible(DMTricksDogButton4, false)
  1830. guiSetVisible(DMTricksDogButton5, false)
  1831. guiSetVisible(DMTricksDogButton6, false)
  1832. guiSetVisible(DMTricksDogButton7, false)
  1833. guiSetVisible(DMTricksDogButton8, false)
  1834.  
  1835. DMTricksTutorialActive = true
  1836.  
  1837. DMGotCursorPosition = false
  1838. DMGetCoursorPosTimer = setTimer(function()
  1839. if(DMGotCursorPosition == false)then
  1840. if (getKeyState( "mouse1" ) == true)then
  1841. DMCursorx, DMCursory, DMworldx, DMworldy, DMworldz = getCursorPosition()
  1842. DMGotCursorPosition = true
  1843. end
  1844. elseif(DMGotCursorPosition == true)then
  1845. if (getKeyState( "mouse1" ) == false)then
  1846. DMStopCursorx, DMStopCursory, DMstopworldx, DMStopworldy, DMStopworldz = getCursorPosition()
  1847. local DMDogTrick
  1848. local DMCursorDifx = DMStopCursorx - DMCursorx
  1849. local DMCursorDify = DMStopCursory - DMCursory
  1850. local DMLeft = false
  1851.  
  1852. if(DMCursorDifx < 0.1 and DMCursorDifx > -0.1)then
  1853. if(DMCursorDify > 0.2 and DMCursorDify < 0.4)then
  1854. DMDogTrick = 1
  1855. DMTrickLength = 1000
  1856. end
  1857. end
  1858.  
  1859. if(DMCursorDifx < 0.1 and DMCursorDifx > -0.1)then
  1860. if(DMCursorDify > 0.4)then
  1861. DMDogTrick = 2
  1862. DMTrickLength = 1000
  1863. end
  1864. end
  1865.  
  1866. --up
  1867. if(DMCursorDifx < 0.1 and DMCursorDifx > -0.1)then
  1868. if(DMCursorDify < -0.2 and DMCursorDify > -0.4)then
  1869. DMDogTrick = 3
  1870. DMTrickLength = 700
  1871. end
  1872. end
  1873.  
  1874. if(DMCursorDifx < 0.1 and DMCursorDifx > -0.1)then
  1875. if(DMCursorDify < -0.4)then
  1876. DMDogTrick = 4
  1877. DMTrickLength = 800
  1878. end
  1879. end
  1880.  
  1881. --right
  1882. if(DMCursorDifx > 0.2 )then
  1883. if(DMCursorDify < 0.1 and DMCursorDify > -0.1)then
  1884. DMDogTrick = 5
  1885. DMTrickLength = 1000
  1886. DMLeft = false
  1887. end
  1888. end
  1889.  
  1890. --left
  1891. if(DMCursorDifx < -0.2 )then
  1892. if(DMCursorDify < 0.1 and DMCursorDify > -0.1)then
  1893. DMDogTrick = 5
  1894. DMTrickLength = 1000
  1895. DMLeft = true
  1896. end
  1897. end
  1898.  
  1899. --upleft
  1900. if(DMCursorDifx < -0.2)then
  1901. if(DMCursorDify < -0.2)then
  1902. DMDogTrick = 7
  1903. DMTrickLength = 900
  1904. end
  1905. end
  1906.  
  1907. --downright
  1908. if(DMCursorDifx < -0.2)then
  1909. if(DMCursorDify > 0.2)then
  1910. DMDogTrick = 8
  1911. DMTrickLength = 2000
  1912. end
  1913. end
  1914.  
  1915. if(DMDogTrick == DMTrickTutorial)then
  1916. killTimer(DMGetCoursorPosTimer)
  1917. showCursor(false)
  1918. guiSetInputEnabled(false)
  1919. removeEventHandler("onClientRender", getRootElement(), DMTricksDogTutorialGui)
  1920. DMTricksTutorialActive = false
  1921. if(DMDogSpawned == true)then
  1922. if(DMDogTrick == 5)then
  1923. if(DMLeft == true)then
  1924. DMDogTrick = 6
  1925. end
  1926. end
  1927. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  1928. DMStatusActive = true
  1929. triggerServerEvent("DMDoTrick", getRootElement(), DMDogTrick, DMDogStatus, DMClientDog, DMTrickLength)
  1930. end
  1931. else
  1932. DMGotCursorPosition = false
  1933. if(DMLanguage == 1)then
  1934. outputChatBox("Трюк не удался", 255,0,0)
  1935. elseif(DMLanguage == 2)then
  1936. outputChatBox("Трюк не удался", 255,0,0)
  1937. end
  1938.  
  1939. end
  1940.  
  1941. end
  1942. end
  1943. end, 50, 0)
  1944.  
  1945. addEventHandler("onClientRender", getRootElement(), DMTricksDogTutorialGui)
  1946. end
  1947. end
  1948.  
  1949. function DMDoTrickGui()
  1950. dxDrawRectangle((DMCursorx + 0.01) * DMScreenx, (DMCursory - 0.01) * DMScreeny, 0.04 * DMScreenx, 0.02 * DMScreeny, tocolor(255, 255, 255, 150))
  1951. dxDrawRectangle((DMCursorx - 0.05) * DMScreenx, (DMCursory - 0.01) * DMScreeny, 0.04 * DMScreenx, 0.02 * DMScreeny, tocolor(255, 255, 255, 150))
  1952. dxDrawRectangle((DMCursorx - 0.01) * DMScreenx, (DMCursory - 0.05) * DMScreeny, 0.02 * DMScreenx, 0.1 * DMScreeny, tocolor(255, 255, 255, 150))
  1953. end
  1954.  
  1955. function DMDoTrick()
  1956. if(isPedInVehicle(getLocalPlayer()) == false and DMBallThrowActive == 0 and DMFeedActive == 0 and DMDogAttacking == false)then
  1957. showCursor(true)
  1958. local DMGotCursorPosition = false
  1959. local DMGetCoursorPosTimer
  1960. local DMDogTrick
  1961. local DMTrickLength
  1962.  
  1963. DMGetCoursorPosTimer = setTimer(function()
  1964. if(DMGotCursorPosition == false)then
  1965. if (getKeyState( "mouse1" ) == true)then
  1966. DMCursorx, DMCursory, DMworldx, DMworldy, DMworldz = getCursorPosition()
  1967. DMGotCursorPosition = true
  1968. addEventHandler("onClientRender", getRootElement(), DMDoTrickGui)
  1969. end
  1970. elseif(DMGotCursorPosition == true)then
  1971. if (getKeyState( "mouse1" ) == false)then
  1972. removeEventHandler("onClientRender", getRootElement(), DMDoTrickGui)
  1973. DMStopCursorx, DMStopCursory, DMstopworldx, DMStopworldy, DMStopworldz = getCursorPosition()
  1974. killTimer(DMGetCoursorPosTimer)
  1975. showCursor(false)
  1976. local DMCursorDifx = DMStopCursorx - DMCursorx
  1977. local DMCursorDify = DMStopCursory - DMCursory
  1978. local DMGotAnim = false
  1979. --down
  1980. if(DMCursorDifx < 0.1 and DMCursorDifx > -0.1)then
  1981. if(DMCursorDify > 0.2 and DMCursorDify < 0.4)then
  1982. if(DMClientDogFitness >= 0)then
  1983. DMDogTrick = 1
  1984. DMTrickLength = 1000
  1985. DMGotAnim = true
  1986. end
  1987. end
  1988. end
  1989.  
  1990. if(DMCursorDifx < 0.1 and DMCursorDifx > -0.1)then
  1991. if(DMCursorDify > 0.4)then
  1992. if(DMClientDogFitness >= 50)then
  1993. DMDogTrick = 2
  1994. DMTrickLength = 1000
  1995. DMGotAnim = true
  1996. end
  1997. end
  1998. end
  1999.  
  2000. --up
  2001. if(DMCursorDifx < 0.1 and DMCursorDifx > -0.1)then
  2002. if(DMCursorDify < -0.2 and DMCursorDify > -0.4)then
  2003. if(DMClientDogFitness >= 5)then
  2004. DMDogTrick = 3
  2005. DMTrickLength = 700
  2006. DMGotAnim = true
  2007. end
  2008. end
  2009. end
  2010.  
  2011. if(DMCursorDifx < 0.1 and DMCursorDifx > -0.1)then
  2012. if(DMCursorDify < -0.4)then
  2013. if(DMClientDogFitness >= 30)then
  2014. DMDogTrick = 4
  2015. DMTrickLength = 800
  2016. DMGotAnim = true
  2017. end
  2018. end
  2019. end
  2020.  
  2021. --right
  2022. if(DMCursorDifx > 0.2 )then
  2023. if(DMCursorDify < 0.1 and DMCursorDify > -0.1)then
  2024. if(DMClientDogFitness >= 15)then
  2025. DMDogTrick = 5
  2026. DMTrickLength = 1000
  2027. DMGotAnim = true
  2028. end
  2029. end
  2030. end
  2031.  
  2032. --left
  2033. if(DMCursorDifx < -0.2 )then
  2034. if(DMCursorDify < 0.1 and DMCursorDify > -0.1)then
  2035. if(DMClientDogFitness >= 15)then
  2036. DMDogTrick = 6
  2037. DMTrickLength = 1000
  2038. DMGotAnim = true
  2039. end
  2040. end
  2041. end
  2042.  
  2043. --upleft
  2044. if(DMCursorDifx < -0.2)then
  2045. if(DMCursorDify < -0.2)then
  2046. if(DMClientDogFitness >= 70)then
  2047. DMDogTrick = 7
  2048. DMTrickLength = 900
  2049. DMGotAnim = true
  2050. end
  2051. end
  2052. end
  2053.  
  2054. --downright
  2055. if(DMCursorDifx < -0.2)then
  2056. if(DMCursorDify > 0.2)then
  2057. if(DMClientDogFitness >= 100)then
  2058. DMDogTrick = 8
  2059. DMTrickLength = 2000
  2060. DMGotAnim = true
  2061. end
  2062. end
  2063. end
  2064.  
  2065. if(DMGotAnim == true)then
  2066. triggerServerEvent("DMDoTrick", getRootElement(), DMDogTrick, DMDogStatus, DMClientDog, DMTrickLength)
  2067. end
  2068. end
  2069. end
  2070. end, 50, 0)
  2071. end
  2072. end
  2073.  
  2074.  
  2075. --INVENTORY (special thanks to brudi r1k3)
  2076. function DMInverntoryBall()
  2077. if(DMDogSpawned == true and DMPlayerInFight == false)then
  2078. if(DMBallThrowActive == 0)then
  2079. local DMStopDog = false
  2080. DMExit(DMStopDog)
  2081.  
  2082. if(DMStatusGuiWasOn == true)then
  2083. DMStatusActive = true
  2084. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  2085. end
  2086.  
  2087.     setPedWeaponSlot(getLocalPlayer(),0)
  2088.     DMBall = createObject(3002,0,0,0)
  2089.     setElementCollisionsEnabled(DMBall,false)
  2090.     addEventHandler("onClientPreRender",getRootElement(),DMkeepInHand)
  2091.     addEventHandler("onClientKey",getRootElement(),DMthrowBall)
  2092.     addEventHandler("onClientPlayerWeaponSwitch", getRootElement(),DMballWeaponSwitch)
  2093.     unbindKey(ChangeStatusKey,"down", DMChangeDogStatus)
  2094.     DMBallThrowActive = 1
  2095. end
  2096. end
  2097. end
  2098.  
  2099. function DMkeepInHand()
  2100.     local x,y,z = getPedBonePosition(getLocalPlayer(),26)
  2101.     setElementPosition(DMBall,x,y,z)
  2102. end
  2103.  
  2104. function DMballWeaponSwitch(prev,cur)
  2105.     if prev == 0 then
  2106.         destroyElement(DMBall)
  2107. removeEventHandler("onClientPreRender",getRootElement(),DMkeepInHand)
  2108. removeEventHandler("onClientKey",getRootElement(),DMthrowBall)
  2109. removeEventHandler("onClientPlayerWeaponSwitch", getRootElement(),DMballWeaponSwitch)
  2110.     DMInventoryBallExit()  
  2111.     end
  2112. end
  2113.  
  2114. function DMthrowBall(button, state)
  2115.     if button == "mouse1" and state == true then
  2116.     DMBallThrowActive = 2
  2117.     DMInventoryBallOnGround = false
  2118.     DMOldDogStatus = DMDogStatus
  2119.     if(DMDogStatus == 1)then
  2120.     destroyElement(DMDogIdleBlip)
  2121.     killTimer(DMDogIdleTimer)
  2122.     DMPositionSyncTimer = setTimer(function()
  2123.     local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2124.     triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  2125.     end, 1000, 0)
  2126.     elseif(DMDogStatus == 2)then
  2127.     removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  2128.     elseif(DMDogStatus == 3)then
  2129.     if(removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow ))then
  2130.     else
  2131.     removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  2132.     end
  2133.     elseif(DMDogStatus == 7)then
  2134.     DMDogAttacking = false
  2135.     removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  2136.     end
  2137.    
  2138.     DMDogStatus = 5
  2139.         setPedAnimation(getLocalPlayer(),"GRENADE", "WEAPON_throw",-1,false)
  2140.         setTimer(function()
  2141.             xInHand,yInHand,zInHand = getElementPosition(DMBall)
  2142.             removeEventHandler("onClientPreRender",getRootElement(),DMkeepInHand)
  2143.             toggleControl("fire",true)
  2144.             setElementPosition(DMBall)
  2145.             pedx, pedy, pedz = getElementPosition(getLocalPlayer())
  2146.             rotx,roty,rotz = getElementRotation(getLocalPlayer())
  2147.             maxZ = pedz+4
  2148.             r = 0.1
  2149.             oldGroundDiff = 1
  2150.             addEventHandler("onClientRender",getRootElement(),DMthrowedBall)
  2151.         end,300,1)
  2152.         setTimer(function()
  2153.             setPedAnimation(getLocalPlayer())
  2154.         end,900,1)
  2155.         removeEventHandler("onClientPlayerWeaponSwitch", getRootElement(),DMballWeaponSwitch)
  2156.         removeEventHandler("onClientKey",getRootElement(),DMthrowBall)
  2157.        
  2158.         local DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(getLocalPlayer())
  2159.         local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMClientDog)
  2160.         local DMDistance = getDistanceBetweenPoints2D (DMPlayerx , DMPlayery, DMClientDogx, DMClientDogy)
  2161.         if(DMDistance >= 20)then
  2162.         if(DMLanguage == 1)then
  2163.           outputChatBox("Ваша собака далеко", 255, 0,0)
  2164.         elseif(DMLanguage == 2)then
  2165.           outputChatBox("Ваша собака далеко", 255,0,0)
  2166.         end
  2167.         destroyElement(DMBall)
  2168.         removeEventHandler("onClientRender",getRootElement(),DMthrowedBall)
  2169.         DMInventoryBallExit()
  2170.         else
  2171.         DMDogFollow = 2
  2172.         addEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  2173.         DMInventoryGetBallTimer = setTimer(function()
  2174.         if(DMLanguage == 1)then
  2175.           outputChatBox("Ваша собака не могла достать мяч", 255, 0,0)
  2176.         elseif(DMLanguage == 2)then
  2177.           outputChatBox("Ваша собака не смогла найти мяч", 255,0,0)
  2178.         end
  2179.         destroyElement(DMBall)
  2180.         removeEventHandler("onClientRender",getRootElement(),DMthrowedBall)
  2181.         DMInventoryBallExit()
  2182.         end, 10000, 1)
  2183.         end
  2184.     end
  2185. end
  2186.  
  2187. function DMthrowedBall()
  2188.     oldx, oldy, oldz = getElementPosition(DMBall)
  2189.     oldz = newz
  2190.     newx = math.cos(math.rad(rotz+90))*r + pedx
  2191.     newy = math.sin(math.rad(rotz+90))*r + pedy
  2192.     newz = -1/30*(r-12)^2 + zInHand + 5
  2193.     oldGroundDiff = newGroundDiff
  2194.     newGroundDiff = oldz-getGroundPosition(oldx,oldy,oldz+1)
  2195.     if newGroundDiff>0 then
  2196.         r = r + 0.8
  2197.         setElementPosition(DMBall,newx,newy,newz)
  2198.     else
  2199.         if newGroundDiff-oldGroundDiff > 1.1 then
  2200.         end
  2201.         removeEventHandler("onClientRender",getRootElement(),DMthrowedBall)
  2202.         setElementPosition(DMBall,oldx,oldy,getGroundPosition(oldx,oldy,oldz+1)+0.1)
  2203.         DMInventoryBallOnGround = true
  2204.     end
  2205. end
  2206.  
  2207. function DMDoggotBall()
  2208. killTimer(DMInventoryGetBallTimer)
  2209. DMDogFollow = 1
  2210. destroyElement(DMBall)
  2211. DMBallThrowActive = 3
  2212. DMGotBallTimer = setTimer(function()
  2213. local DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(getLocalPlayer())
  2214. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMClientDog)
  2215. local DMDistance = getDistanceBetweenPoints2D (DMPlayerx , DMPlayery, DMClientDogx, DMClientDogy)
  2216. if(DMDistance <= 1.5)then
  2217. killTimer(DMGotBallTimer)
  2218. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  2219. DMInventoryBallExit()
  2220. end
  2221. end, 50,0)
  2222. end
  2223.  
  2224. function DMInventoryBallExit()
  2225. bindKey(ChangeStatusKey,"down", DMChangeDogStatus)
  2226.     if(DMBallThrowActive == 2 or DMBallThrowActive == 3)then
  2227.         if(DMOldDogStatus == 1 )then
  2228.           triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2229.           killTimer(DMPositionSyncTimer)
  2230.           DMDogStatus = 1
  2231.           DMDogIdleTimer = setTimer(function()
  2232.           destroyElement(DMDogIdleBlip)
  2233.           local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2234.           DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  2235.  
  2236.           local block, anim = getPedAnimation ( DMClientDog )
  2237.           if(anim ~= "OFF_Sit_Crash")then
  2238.           triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2239.           end
  2240.           end, 5000, 0)
  2241.         elseif(DMOldDogStatus == 2 or DMOldDogStatus == 3 or DMOldDogStatus == 7)then
  2242.           DMDogFollow = 1
  2243.           DMDogDistanceAnimation = 0
  2244.           addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  2245.           if(DMOldDogStatus == 7)then
  2246.           DMOldDogStatus = 3
  2247.           end
  2248.            DMDogStatus = DMOldDogStatus
  2249.         end
  2250.  
  2251.     end
  2252. DMBallThrowActive = 0
  2253. end
  2254.  
  2255.  
  2256. --TASKS
  2257. function DMDogActionGuard()
  2258. local DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(DMGuardPlayerFound)
  2259. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMClientDog)
  2260. local DMDogFinalRotation
  2261. local DMDogDistanceAnimationChange
  2262. local DMDogRescueTeleport
  2263. local DMDogRotation = math.deg(math.atan((DMPlayerx - DMClientDogx) / (DMPlayery - DMClientDogy)))
  2264.  
  2265. if(DMPlayerx > DMClientDogx and DMPlayery > DMClientDogy)then
  2266. DMDogFinalRotation = DMDogRotation
  2267. elseif(DMPlayerx > DMClientDogx and DMPlayery < DMClientDogy)then
  2268. DMDogFinalRotation = 180 + DMDogRotation
  2269. elseif(DMPlayerx < DMClientDogx and DMPlayery < DMClientDogy)then
  2270. DMDogFinalRotation = 180 + DMDogRotation
  2271. elseif(DMPlayerx < DMClientDogx and DMPlayery > DMClientDogy)then
  2272. DMDogFinalRotation = 360 + DMDogRotation
  2273. end
  2274.  
  2275. if(DMDogFinalRotation == nil)then
  2276. DMDogFinalRotation = 0
  2277. end
  2278.  
  2279. local DMDistance = getDistanceBetweenPoints2D (DMPlayerx , DMPlayery, DMClientDogx, DMClientDogy)
  2280.  
  2281. if(DMDistance <= 1.5)then
  2282.   if(DMDogDistanceAnimation ~= 1)then
  2283.   DMDogDistanceAnimation = 1
  2284.   DMDogDistanceAnimationChange = true
  2285.   if( DMDogFollow == 2 and DMInventoryBallOnGround == true)then
  2286.   DMDoggotBall()
  2287.   end
  2288.   elseif(DMDogDistanceAnimation == 1)then
  2289.   DMDogDistanceAnimationChange = false
  2290.   end
  2291. elseif(DMDistance > 1.5 and DMDistance <= 4)then
  2292.   if(DMDogDistanceAnimation ~= 2)then
  2293.   DMDogDistanceAnimation = 2
  2294.   DMDogDistanceAnimationChange = true
  2295.   elseif(DMDogDistanceAnimation == 2)then
  2296.   DMDogDistanceAnimationChange = false
  2297.   end
  2298. elseif(DMDistance > 4 and DMDistance <= 7 )then
  2299.  if(DMDogDistanceAnimation ~= 3)then
  2300.  DMDogDistanceAnimation = 3
  2301.  DMDogDistanceAnimationChange = true
  2302.  elseif(DMDogDistanceAnimation == 3)then
  2303.  DMDogDistanceAnimationChange = false
  2304.  end
  2305. elseif(DMDistance > 7 and DMDistance <= 50)then
  2306.  if(DMDogDistanceAnimation ~= 4)then
  2307.  DMDogDistanceAnimation = 4
  2308.  DMDogDistanceAnimationChange = true
  2309.  elseif(DMDogDistanceAnimation == 4)then
  2310.  DMDogDistanceAnimationChange = false
  2311.  end
  2312. end
  2313.  
  2314. if(DMDistance > 50 )then
  2315.  DMDogRescueTeleport = true
  2316. else
  2317.  DMDogRescueTeleport = false
  2318. end
  2319.  
  2320. DMAttackCount = DMAttackCount + 1
  2321. if(DMAttackCount == 50)then
  2322. DMAttackCount = 0
  2323. end
  2324.  
  2325. triggerServerEvent("DMDogActionGuard", getRootElement(), DMDogFinalRotation, DMDogDistanceAnimation, DMDogDistanceAnimationChange, DMClientDog, DMDogRescueTeleport, DMAttackCount, DMGuardPlayerFound, DMClientDogStrength)
  2326. end
  2327.  
  2328. function DMDogGuard()
  2329. if(DMDogSpawned == true)then
  2330. DMDogGuardActive = 1
  2331. local DMStopDog = false
  2332. DMExit(DMStopDog)
  2333. DMExitStatus()
  2334. --POS SYNC
  2335. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2336. DogGuardingx, DogGuardingy, DogGuardingz = getElementPosition(DMClientDog)
  2337. DMDogIdleBlip = createBlip ( DogGuardingx, DogGuardingy, DogGuardingz , 0, 2, 255, 0, 0, 255, 0, 250)
  2338. DMOldDogStatus = DMDogStatus
  2339. DMDogStatus = 6
  2340. DMGuardFollowActive = false
  2341. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  2342. DMGuardCollision = createColCircle ( DogGuardingx, DogGuardingy, 8 )
  2343. local DMGuardAttack = false
  2344.  
  2345. DMDogGuardingTimer = setTimer(function()
  2346.  
  2347. local players = getElementsWithinColShape ( DMGuardCollision, "player" )
  2348. DMAlreadyFound = false
  2349. local theKey, thePlayer
  2350. for theKey,thePlayer in ipairs(players) do
  2351.     if(DMAlreadyFound == false)then
  2352.     if(isPedInVehicle(thePlayer) == false)then
  2353.     if(thePlayer ~= getLocalPlayer())then
  2354.     DMGuardPlayerFound = thePlayer
  2355.     DMAlreadyFound = true
  2356.     end
  2357.     end
  2358.     end
  2359. end
  2360.  
  2361. if(DMAlreadyFound == true)then
  2362. if(DMGuardAttack == false)then
  2363. DMAttackCount = 0
  2364. addEventHandler("onClientRender", getRootElement(), DMDogActionGuard)
  2365. DMDogGuardActive = 2
  2366. DMGuardAttack = true
  2367. DMGuardSound()
  2368. end
  2369. else
  2370. if(DMGuardAttack == true)then
  2371. DMDogGuardActive = 1
  2372. removeEventHandler("onClientRender", getRootElement(), DMDogActionGuard )
  2373. DMGuardAttack = false
  2374. end
  2375. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2376. local DMDistance = getDistanceBetweenPoints2D ( DogGuardingx, DogGuardingy, Dogx, Dogy)
  2377. if(DMDistance <= 1.5)then
  2378. local block, anim = getPedAnimation ( DMClientDog )
  2379. if(anim ~= "OFF_Sit_Crash")then
  2380. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2381. end
  2382. if(DMGuardFollowActive == true)then
  2383. DMGuardFollowActive = false
  2384. DMDogGuardActive = 1
  2385. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  2386. end
  2387. else
  2388. DMDogDistanceAnimation = 0
  2389. DMDogFollow = 4
  2390. DMGuardFollowActive = true
  2391. DMDogGuardActive = 3
  2392. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  2393. end
  2394. end
  2395. end, 1000, 0)
  2396. end
  2397. end
  2398.  
  2399. function DMDogGuardExit()
  2400. if(DMDogGuardActive == 1)then
  2401. killTimer(DMDogGuardingTimer)
  2402. destroyElement(DMDogIdleBlip)
  2403. destroyElement(DMGuardCollision)
  2404. elseif(DMDogGuardActive == 2)then
  2405. killTimer(DMDogGuardingTimer)
  2406. destroyElement(DMDogIdleBlip)
  2407. destroyElement(DMGuardCollision)
  2408. removeEventHandler("onClientRender", getRootElement(), DMDogActionGuard )
  2409. elseif(DMDogGuardActive == 3)then
  2410. killTimer(DMDogGuardingTimer)
  2411. destroyElement(DMDogIdleBlip)
  2412. destroyElement(DMGuardCollision)
  2413. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  2414. end
  2415. if(DMDogGuardActive == 1 or DMDogGuardActive == 2 or DMDogGuardActive == 3)then
  2416. DMDogGuardActive = 0
  2417. if(DMOldDogStatus == 1)then
  2418. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2419. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2420. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  2421. DMDogStatus = 1
  2422. DMDogIdleTimer = setTimer(function()
  2423. destroyElement(DMDogIdleBlip)
  2424. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2425. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  2426.  
  2427. local block, anim = getPedAnimation ( DMClientDog )
  2428. if(anim ~= "OFF_Sit_Crash")then
  2429. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2430. end
  2431. end, 5000, 0)
  2432. elseif(DMOldDogStatus == 2)then
  2433. DMDogStatus = 2
  2434. DMDogDistanceAnimation = 0
  2435. if(DMClientDogFitness < 100)then
  2436. DMDogFitnessTimer = setTimer(function()
  2437.  if(DMClientDogFitness < 100)then
  2438.    DMClientDogFitness = DMClientDogFitness + 0.02
  2439.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  2440.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  2441.   else
  2442.    DMClientDogFitness = 100
  2443.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  2444.    killTimer(DMDogFitnessTimer)
  2445.   end
  2446. end, 15000, 0)
  2447. end
  2448. DMPositionSyncTimer = setTimer(function()
  2449. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2450. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  2451. end, 1000, 0)
  2452. DMDogFollow = 1
  2453. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  2454. elseif(DMOldDogStatus == 3)then
  2455. DMDogStatus = 3
  2456. DMDogDistanceAnimation = 0
  2457. if(DMClientDogFitness < 100)then
  2458. DMDogFitnessTimer = setTimer(function()
  2459.  if(DMClientDogFitness < 100)then
  2460.    DMClientDogFitness = DMClientDogFitness + 0.02
  2461.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  2462.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  2463.   else
  2464.    DMClientDogFitness = 100
  2465.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  2466.    killTimer(DMDogFitnessTimer)
  2467.   end
  2468. end, 15000, 0)
  2469. end
  2470. DMPositionSyncTimer = setTimer(function()
  2471. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2472. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  2473. end, 1000, 0)
  2474. DMDogFollow = 1
  2475. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  2476. end
  2477. end
  2478. end
  2479.  
  2480. function DMDogFightGui()
  2481. if(DMLanguage == 1)then
  2482. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.22 * DMScreeny, tocolor(20, 20, 20, 220))
  2483. dxDrawText("Бой собак", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  2484. dxDrawLine(0.78 *DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  2485. dxDrawLine(0.78 *DMScreenx, 0.39 * DMScreeny, 0.95 * DMScreenx, 0.39 * DMScreeny, tocolor(255, 255, 255, 220))
  2486. dxDrawText("Введите имя игрока, с которым вы хотите сражаться. Собака сражается с собакой и победитель становится сильнее!", 0.785 * DMScreenx, 0.41 * DMScreeny, 0.95 * DMScreenx, 0.47 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "top", false, true)
  2487.  
  2488. dxDrawImage(0.9 * DMScreenx, 0.47 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  2489. dxDrawText("Done", 0.9 * DMScreenx, 0.473 * DMScreeny, DMScreenx * 0.942, DMScreeny * 0.513, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  2490. elseif(DMLanguage == 2)then
  2491. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.22 * DMScreeny, tocolor(20, 20, 20, 220))
  2492. dxDrawText("Бой собак", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  2493.  
  2494. dxDrawLine(0.78 *DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  2495. dxDrawLine(0.78 *DMScreenx, 0.39 * DMScreeny, 0.95 * DMScreenx, 0.39 * DMScreeny, tocolor(255, 255, 255, 220))
  2496. dxDrawText("Введите имя игрока, с которым вы хотите сражаться. Собака сражается с собакой и победитель становится сильнее!", 0.785 * DMScreenx, 0.41 * DMScreeny, 0.95 * DMScreenx, 0.47 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "top", false, true)
  2497. dxDrawImage(0.9 * DMScreenx, 0.47 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  2498. dxDrawText("Fertig", 0.9 * DMScreenx, 0.473 * DMScreeny, DMScreenx * 0.942, DMScreeny * 0.513, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  2499. end
  2500. end
  2501.  
  2502. function DMDogFightInteractives()
  2503. DMDogFightEdit = guiCreateEdit ( 0.79 * DMScreenx, 0.335 * DMScreeny, 0.15 * DMScreenx, 0.05 * DMScreeny, "", false)
  2504. guiSetAlpha(DMDogFightEdit, 0.8)
  2505. guiSetVisible(DMDogFightEdit, false)
  2506.  
  2507. DMDogFightButton = guiCreateButton ( 0.9 * DMScreenx, 0.473 * DMScreeny, 0.042 * DMScreenx, 0.04 * DMScreeny, "", false)
  2508. guiSetAlpha(DMDogFightButton, 0)
  2509. guiSetVisible(DMDogFightButton, false)
  2510. addEventHandler ( "onClientGUIClick", DMDogFightButton, DMDogFightStart, false )
  2511. end
  2512.  
  2513. function DMDogFight()
  2514. if(DMDogSpawned == true)then
  2515. guiSetVisible(DMDogTasksButton1, false)
  2516. guiSetVisible(DMDogTasksButton2, false)
  2517. guiSetVisible(DMDogTasksButton3, false)
  2518. removeEventHandler("onClientRender", getRootElement(), DMDogTasksGui)
  2519. DMDogTasksPanel = false
  2520.  
  2521. guiSetVisible(DMDogFightEdit, true)
  2522. guiSetVisible(DMDogFightButton, true)
  2523. addEventHandler("onClientRender", getRootElement(), DMDogFightGui)
  2524. DMDogFightPanel = true
  2525. end
  2526. end
  2527.  
  2528. function DMDogFightStart()
  2529. local DMStopDog = false
  2530. DMExit(DMStopDog)
  2531. if(DMDogSpawned == true)then
  2532. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  2533. DMStatusActive = true
  2534. end
  2535.  
  2536. local DMDogFightPlayer = getPlayerFromName(guiGetText(DMDogFightEdit))
  2537. if(DMDogFightPlayer == false)then
  2538. if(DMLanguage == 1)then
  2539. outputChatBox("Не могу найти человека", 255, 0,0)
  2540. elseif(DMLanguage == 2)then
  2541. outputChatBox("Человек не может быть найден", 255, 0,0)
  2542. end
  2543. else
  2544. if(DMDogFightPlayer == getLocalPlayer())then
  2545. if(DMLanguage == 1)then
  2546. outputChatBox("Вы не можете бороться со своими", 255,0,0)
  2547. elseif(DMLanguage == 2)then
  2548. outputChatBox("Вы не можете бороться с собой", 255,0,0)
  2549. end
  2550. else
  2551. if(isPedInVehicle(DMDogFightPlayer) == true)then
  2552. if(DMLanguage == 1)then
  2553. outputChatBox(getPlayerName(DMDogFightPlayer).." в данный момент за рулем", 255,0,0)
  2554. elseif(DMLanguage == 2)then
  2555. outputChatBox(getPlayerName(DMDogFightPlayer).." в данный момент за рулем", 255,0,0)
  2556. end
  2557. else
  2558. local DMx, DMy, DMz = getElementPosition(getLocalPlayer())
  2559. local DMOpponentx, DMOpponenty, DMOpponentz = getElementPosition(DMDogFightPlayer)
  2560. local DMDistance = getDistanceBetweenPoints2D (DMx , DMy, DMOpponentx, DMOpponenty)
  2561.  
  2562. if(DMDistance <= 20)then
  2563. triggerServerEvent("DMDogFightRequest", getRootElement(), DMDogFightPlayer, DMClientDog)
  2564. DMPlayerInFight = true
  2565. DMRequestPlayer = getPlayerName(DMDogFightPlayer)
  2566. else
  2567. if(DMLanguage == 1)then
  2568. outputChatBox(getPlayerName(DMDogFightPlayer).." слишком далеко", 255,0,0)
  2569. elseif(DMLanguage == 2)then
  2570. outputChatBox(getPlayerName(DMDogFightPlayer).." слишком далеко", 255,0,0)
  2571. end
  2572. end
  2573. end
  2574. end
  2575. end
  2576. end
  2577.  
  2578. function DMDogFightRequestGui()
  2579. if(DMLanguage == 1)then
  2580. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.22 * DMScreeny, tocolor(20, 20, 20, 220))
  2581. dxDrawText("Dog Fight", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  2582.  
  2583. dxDrawLine(0.78 *DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  2584. dxDrawLine(0.78 *DMScreenx, 0.39 * DMScreeny, 0.95 * DMScreenx, 0.39 * DMScreeny, tocolor(255, 255, 255, 220))
  2585. dxDrawText(DMRequestPlayer, 0.79 * DMScreenx, 0.335 * DMScreeny, 0.941 * DMScreenx, 0.385 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex * 1.1, DMTextSizey * 1.1 , "pricedown", "center", "center")
  2586.  
  2587. dxDrawText("Хочет сразиться с тобой!", 0.785 * DMScreenx, 0.42 * DMScreeny, 0.95 * DMScreenx, 0.42 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex* 1.2, DMTextSizey* 1.2, "default-bold", "center", "center")
  2588.  
  2589. dxDrawImage(0.8 * DMScreenx, 0.463 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  2590. dxDrawImage(0.89 * DMScreenx, 0.463 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  2591. dxDrawText("Принять", 0.8 * DMScreenx, 0.463 * DMScreeny, DMScreenx * 0.842, DMScreeny * 0.513, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  2592. dxDrawText("Отменить", 0.89 * DMScreenx, 0.463 * DMScreeny, DMScreenx * 0.932, DMScreeny * 0.513, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  2593. elseif(DMLanguage == 2)then
  2594. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.22 * DMScreeny, tocolor(20, 20, 20, 220))
  2595. dxDrawText("Бой собак", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  2596.  
  2597. dxDrawLine(0.78 *DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  2598. dxDrawLine(0.78 *DMScreenx, 0.39 * DMScreeny, 0.95 * DMScreenx, 0.39 * DMScreeny, tocolor(255, 255, 255, 220))
  2599. dxDrawText(DMRequestPlayer, 0.79 * DMScreenx, 0.335 * DMScreeny, 0.941 * DMScreenx, 0.385 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex * 1.1, DMTextSizey * 1.1 , "pricedown", "center", "center")
  2600.  
  2601. dxDrawText("Бросает вызов вам бороться!", 0.785 * DMScreenx, 0.42 * DMScreeny, 0.95 * DMScreenx, 0.42 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex* 1.2, DMTextSizey* 1.2, "default-bold", "center", "center")
  2602.  
  2603. dxDrawImage(0.8 * DMScreenx, 0.463 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  2604. dxDrawImage(0.89 * DMScreenx, 0.463 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  2605. dxDrawText("Принять", 0.8 * DMScreenx, 0.463 * DMScreeny, DMScreenx * 0.842, DMScreeny * 0.513, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  2606. dxDrawText("Отменить", 0.89 * DMScreenx, 0.463 * DMScreeny, DMScreenx * 0.932, DMScreeny * 0.513, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  2607. end
  2608. end
  2609.  
  2610. function DMDogFightRequestInteractives()
  2611. DMDogFightRequestButton1 = guiCreateButton ( 0.8 * DMScreenx, 0.463 * DMScreeny, 0.042 * DMScreenx, 0.04 * DMScreeny, "", false)
  2612. guiSetAlpha(DMDogFightRequestButton1, 0)
  2613. guiSetVisible(DMDogFightRequestButton1, false)
  2614. addEventHandler ( "onClientGUIClick", DMDogFightRequestButton1, DMDogsFightStart, false )
  2615.  
  2616. DMDogFightRequestButton2 = guiCreateButton ( 0.89 * DMScreenx, 0.463 * DMScreeny, 0.042 * DMScreenx, 0.04 * DMScreeny, "", false)
  2617. guiSetAlpha(DMDogFightRequestButton2, 0)
  2618. guiSetVisible(DMDogFightRequestButton2, false)
  2619. addEventHandler ( "onClientGUIClick", DMDogFightRequestButton2, DMDogFightRequestDecilned, false )
  2620. end
  2621.  
  2622. function DMDogFightRequestBack(RequestPlayer, DMRequestDog)
  2623. if(DMPlayerInFight == false)then
  2624. if(DMClientOwnerGotDog == true and DMDogDeathRevive == true)then
  2625. local DMStopDog = false
  2626. DMExit(DMStopDog)
  2627. triggerServerEvent("DMDogFightRequestSent", getRootElement(), RequestPlayer)
  2628. DMRequestPlayer = getPlayerName(RequestPlayer)
  2629. DMClientRequestDog = DMRequestDog
  2630. showCursor(true)
  2631. guiSetInputEnabled(true)
  2632. addEventHandler("onClientRender", getRootElement(), DMDogFightRequestGui)
  2633. guiSetVisible(DMDogFightRequestButton1, true)
  2634. guiSetVisible(DMDogFightRequestButton2, true)
  2635. DMDogFightRequestPanel = true
  2636. DMPlayerInFight = true
  2637. DMRequestClose = true
  2638. else
  2639. local DMRequestError = 1
  2640. triggerServerEvent("DMDogFightRequestFailed", getRootElement(), RequestPlayer, DMRequestError)
  2641. end
  2642. else
  2643. local DMRequestError = 2
  2644. triggerServerEvent("DMDogFightRequestFailed", getRootElement(), RequestPlayer, DMRequestError)
  2645. end
  2646. end
  2647.  
  2648. function DMDogFightRequestFailed(DMOpponent, DMRequestError)
  2649. if(DMRequestError == 1)then
  2650. if(DMLanguage == 1)then
  2651. outputChatBox(getPlayerName(DMOpponent).." не имеет собаку", 255,0,0)
  2652. elseif(DMLanguage == 2)then
  2653. outputChatBox(getPlayerName(DMOpponent).." нет собаки", 255,0,0)
  2654. end
  2655. elseif(DMRequestError == 2)then
  2656. if(DMLanguage == 1)then
  2657. outputChatBox(getPlayerName(DMOpponent).." уже в бою", 255,0,0)
  2658. elseif(DMLanguage == 2)then
  2659. outputChatBox(getPlayerName(DMOpponent).." уже в бою", 255,0,0)
  2660. end
  2661. end
  2662. DMPlayerInFight = false
  2663. end
  2664.  
  2665. function DMDogFightRequestSent()
  2666. if(DMLanguage == 1)then
  2667. outputChatBox("Запрос на бой с собакой отправлен", 255 , 255,0)
  2668. elseif(DMLanguage == 2)then
  2669. outputChatBox("Запрос на бой с собакой отправлен", 255 , 255,0)
  2670. end
  2671. end
  2672.  
  2673. function DMDogsFightStart()
  2674. if(DMLanguage == 1)then
  2675. outputChatBox("Собачьи бои начались", 255, 255,0)
  2676. elseif(DMLanguage == 2)then
  2677. outputChatBox("Собачьи бои начались", 255, 255,0)
  2678. end
  2679.  
  2680. showCursor(false)
  2681. guiSetInputEnabled(false)
  2682. removeEventHandler("onClientRender", getRootElement(), DMDogFightRequestGui)
  2683. guiSetVisible(DMDogFightRequestButton1, false)
  2684. guiSetVisible(DMDogFightRequestButton2, false)
  2685. DMDogFightRequestPanel = false
  2686.  
  2687. if(DMDogSpawned == false)then
  2688. DMOnlySpawn = true
  2689. DMSpawnDog()
  2690. elseif(DMDogSpawned == true)then
  2691. local DMStopDog = false
  2692. DMExit(DMStopDog)
  2693. DMExitStatus()
  2694. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  2695. DMStatusActive = true
  2696. unbindKey(ChangeStatusKey, "down", DMChangeDogStatus)
  2697. end
  2698.  
  2699. DMDogStatus = 7
  2700. if(DMClientDogFitness < 100)then
  2701. DMDogFitnessTimer = setTimer(function()
  2702.  if(DMClientDogFitness < 100)then
  2703.    DMClientDogFitness = DMClientDogFitness + 0.02
  2704.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  2705.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  2706.   else
  2707.    DMClientDogFitness = 100
  2708.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  2709.    killTimer(DMDogFitnessTimer)
  2710.   end
  2711. end, 15000, 0)
  2712. end
  2713. DMPositionSyncTimer = setTimer(function()
  2714. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2715. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  2716. end, 1000, 0)
  2717.  
  2718. local RequestPlayer = getPlayerFromName(DMRequestPlayer)
  2719. DMAttackCount = 0
  2720. DMDogAttack = 2
  2721.  
  2722. setTimer(function()
  2723. addEventHandler("onClientRender", getRootElement(), DMDogActionAttack )
  2724. DMDogAttacking = true
  2725. DMFightSound1 = playSound("sounds/barklong.mp3", true)
  2726. setTimer(function() DMFightSound2 = playSound("sounds/barklong.mp3", true) end, 1200,1)
  2727. triggerServerEvent("DMDogsFightStart", getRootElement(), RequestPlayer, DMClientDog)
  2728. end, 500, 1)
  2729. end
  2730.  
  2731. function DMDogsFightStartBack(DMRequestDog)
  2732. if(DMLanguage == 1)then
  2733. outputChatBox("Dogfight start", 255, 255,0)
  2734. elseif(DMLanguage == 2)then
  2735. outputChatBox("Hundekampf startet", 255, 255,0)
  2736. end
  2737.  
  2738. local DMStopDog = false
  2739. DMExit(DMStopDog)
  2740. DMExitStatus()
  2741. unbindKey(ChangeStatusKey, "down", DMChangeDogStatus)
  2742. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  2743.  
  2744. DMDogStatus = 7
  2745. if(DMClientDogFitness < 100)then
  2746. DMDogFitnessTimer = setTimer(function()
  2747.  if(DMClientDogFitness < 100)then
  2748.    DMClientDogFitness = DMClientDogFitness + 0.02
  2749.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  2750.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  2751.   else
  2752.    DMClientDogFitness = 100
  2753.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  2754.    killTimer(DMDogFitnessTimer)
  2755.   end
  2756. end, 15000, 0)
  2757. end
  2758. DMPositionSyncTimer = setTimer(function()
  2759. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2760. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  2761. end, 1000, 0)
  2762.  
  2763. DMClientRequestDog = DMRequestDog
  2764. DMAttackCount = 0
  2765. DMDogAttack = 2
  2766. DMFightSound1 = playSound("sounds/barklong.mp3", true)
  2767. setTimer(function() DMFightSound2 = playSound("sounds/barklong.mp3", true) end, 1200,1)
  2768. addEventHandler("onClientRender", getRootElement(), DMDogActionAttack )
  2769. DMDogAttacking = true
  2770. end
  2771.  
  2772. function DMDogFightRequestDecilned()
  2773. DMPlayerInFight = false
  2774. showCursor(false)
  2775. guiSetInputEnabled(false)
  2776. removeEventHandler("onClientRender", getRootElement(), DMDogFightRequestGui)
  2777. guiSetVisible(DMDogFightRequestButton1, false)
  2778. guiSetVisible(DMDogFightRequestButton2, false)
  2779. DMDogFightRequestPanel = false
  2780.  
  2781. local RequestPlayer = getPlayerFromName(DMRequestPlayer)
  2782. triggerServerEvent("DMDogFightRequestDecilned", getRootElement(), RequestPlayer)
  2783. if(DMDogSpawned == true)then
  2784. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  2785. DMStatusActive = true
  2786. end
  2787. end
  2788.  
  2789. function DMDogFightRequestDecilnedBack()
  2790. if(DMLanguage == 1)then
  2791. outputChatBox("Ваш запрос был отклонен", 255, 0,0)
  2792. elseif(DMLanguage == 2)then
  2793. outputChatBox("Ваш запрос был отклонен", 255, 0,0)
  2794. end
  2795. DMPlayerInFight = false
  2796. end
  2797.  
  2798. function DMDogFightLose()
  2799. DMPlayerInFight = false
  2800. DMDogRevive()
  2801. if(DMLanguage == 1)then
  2802. outputChatBox("Ваша собака проиграла бой!",255,255,0)
  2803. elseif(DMLanguage == 2)then
  2804. outputChatBox("Ваша собака проиграла бой!",255,255,0)
  2805. end
  2806. end
  2807.  
  2808. function DMDogFightWin()
  2809. DMPlayerInFight = false
  2810. if(DMLanguage == 1)then
  2811. outputChatBox("Ваша собака выиграла бой!",0,255,0)
  2812. elseif(DMLanguage == 2)then
  2813. outputChatBox("Ваша собака выиграла бой!",0,255,0)
  2814. end
  2815. DMExitStatus()
  2816. DMClientDogStrength = DMClientDogStrength + 2
  2817. triggerServerEvent("DMSaveStatStrength", getRootElement(), DMClientDogStrength)
  2818.  
  2819. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2820. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2821. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  2822. DMDogStatus = 1
  2823. DMDogIdleTimer = setTimer(function()
  2824. destroyElement(DMDogIdleBlip)
  2825. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2826. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  2827.  
  2828. local block, anim = getPedAnimation ( DMClientDog )
  2829. if(anim ~= "OFF_Sit_Crash")then
  2830. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2831. end
  2832. end, 5000, 0)
  2833.  
  2834. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  2835. bindKey(DoTrickKey,"down", DMDoTrick)
  2836. end
  2837.  
  2838. function DMDogsFightGiveUpBack(RequestPlayer)
  2839. DMPlayerInFight = false
  2840. if(DMLanguage == 1)then
  2841. outputChatBox(getPlayerName(RequestPlayer).." Бросил бой!", 0, 255,0)
  2842. elseif(DMLanguage == 2)then
  2843. outputChatBox(getPlayerName(RequestPlayer).." Бросил бой", 0, 255,0)
  2844. end
  2845.  
  2846. DMExitStatus()
  2847. DMClientDogStrength = DMClientDogStrength + 2
  2848. triggerServerEvent("DMSaveStatStrength", getRootElement(), DMClientDogStrength)
  2849.  
  2850. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2851. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2852. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  2853. DMDogStatus = 1
  2854. DMDogIdleTimer = setTimer(function()
  2855. destroyElement(DMDogIdleBlip)
  2856. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  2857. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  2858.  
  2859. local block, anim = getPedAnimation ( DMClientDog )
  2860. if(anim ~= "OFF_Sit_Crash")then
  2861. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  2862. end
  2863. end, 5000, 0)
  2864. end
  2865.  
  2866.  
  2867. function DMDogSniff()
  2868. if(DMDogSpawned == true)then
  2869. guiSetVisible(DMDogTasksButton1, false)
  2870. guiSetVisible(DMDogTasksButton2, false)
  2871. guiSetVisible(DMDogTasksButton3, false)
  2872. removeEventHandler("onClientRender", getRootElement(), DMDogTasksGui)
  2873. DMDogTasksPanel = false
  2874.  
  2875. guiSetVisible(DMDogSniffEdit, true)
  2876. guiSetVisible(DMDogSniffButton, true)
  2877. addEventHandler("onClientRender", getRootElement(), DMDogSniffGui)
  2878. DMDogSniffPanel = true
  2879. end
  2880. end
  2881.  
  2882. function DMDogSniffGui()
  2883. if(DMLanguage == 1)then
  2884. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.22 * DMScreeny, tocolor(20, 20, 20, 220))
  2885. dxDrawText("Нюхает человека", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  2886.  
  2887. dxDrawLine(0.78 *DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  2888. dxDrawLine(0.78 *DMScreenx, 0.39 * DMScreeny, 0.95 * DMScreenx, 0.39 * DMScreeny, tocolor(255, 255, 255, 220))
  2889.  
  2890. dxDrawText("Введите имя игрока, которого вы хотите найти. Он отмечен на карте", 0.785 * DMScreenx, 0.41 * DMScreeny, 0.94 * DMScreenx, 0.47 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "top", false, true)
  2891.  
  2892. dxDrawImage(0.9 * DMScreenx, 0.47 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  2893. dxDrawText("Done", 0.9 * DMScreenx, 0.473 * DMScreeny, DMScreenx * 0.942, DMScreeny * 0.513, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  2894. elseif(DMLanguage == 2)then
  2895. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.22 * DMScreeny, tocolor(20, 20, 20, 220))
  2896. dxDrawText("Нюхает человека", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  2897.  
  2898. dxDrawLine(0.78 *DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  2899. dxDrawLine(0.78 *DMScreenx, 0.39 * DMScreeny, 0.95 * DMScreenx, 0.39 * DMScreeny, tocolor(255, 255, 255, 220))
  2900.  
  2901. dxDrawText("Введите имя игрока, которого вы хотите найти. Он отмечен на карте", 0.785 * DMScreenx, 0.41 * DMScreeny, 0.94 * DMScreenx, 0.47 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "default-bold", "center", "top", false, true)
  2902.  
  2903. dxDrawImage(0.9 * DMScreenx, 0.47 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  2904. dxDrawText("Fertig", 0.9 * DMScreenx, 0.473 * DMScreeny, DMScreenx * 0.942, DMScreeny * 0.513, tocolor(0, 0, 0, 220), DMTextSizex * 0.7, DMTextSizey * 0.7, "beckett", "center", "center")
  2905. end
  2906. end
  2907.  
  2908. function DMDogSniffInteractives()
  2909. DMDogSniffEdit = guiCreateEdit ( 0.79 * DMScreenx, 0.335 * DMScreeny, 0.15 * DMScreenx, 0.05 * DMScreeny, "", false)
  2910. guiSetAlpha(DMDogSniffEdit, 0.8)
  2911. guiSetVisible(DMDogSniffEdit, false)
  2912.  
  2913. DMDogSniffButton = guiCreateButton ( 0.9 * DMScreenx, 0.473 * DMScreeny, 0.042 * DMScreenx, 0.04 * DMScreeny, "", false)
  2914. guiSetAlpha(DMDogSniffButton, 0)
  2915. guiSetVisible(DMDogSniffButton, false)
  2916. addEventHandler ( "onClientGUIClick", DMDogSniffButton, DMDogActionSniff, false )
  2917. end
  2918.  
  2919. function DMDogActionSniff()
  2920. local DMStopDog = false
  2921. DMExit(DMStopDog)
  2922.  
  2923. if(DMDogSpawned == true)then
  2924. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  2925. DMStatusActive = true
  2926. end
  2927.  
  2928. local DMDogFightPlayer = getPlayerFromName(guiGetText(DMDogSniffEdit))
  2929. if(DMDogFightPlayer == false)then
  2930. if(DMLanguage == 1)then
  2931. outputChatBox("Твоя собака ничего не нашла", 255, 0,0)
  2932. elseif(DMLanguage == 2)then
  2933. outputChatBox("Твоя собака ничего не нашла", 255, 0,0)
  2934. end
  2935. else
  2936. local DMPlayerx, DMPlayery, DMPlayerz = getElementPosition(DMDogFightPlayer)
  2937. DMDogSniffBlip = createBlip ( DMPlayerx, DMPlayery, DMPlayerz , 58, 2, 255, 0, 0, 255, 0, 9999)
  2938. if(DMLanguage == 1)then
  2939. outputChatBox("Found "..getPlayerName(DMDogFightPlayer).."!", 0,255,0)
  2940. elseif(DMLanguage == 2)then
  2941. outputChatBox(getPlayerName(DMDogFightPlayer).." Был найден!", 0,255,0)
  2942. end
  2943. setTimer(function()
  2944. destroyElement(DMDogSniffBlip)
  2945. end, 10000, 1)
  2946. end
  2947. end
  2948.  
  2949.  
  2950.  
  2951. function DMDogTasksGui()
  2952. if(DMLanguage == 1)then
  2953. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  2954. dxDrawText("Задачи собак", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  2955.  
  2956. dxDrawLine(0.78 * DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  2957. dxDrawLine(0.78 * DMScreenx, 0.3785 * DMScreeny, 0.95 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220))
  2958. dxDrawLine(0.78 * DMScreenx, 0.427 * DMScreeny, 0.95 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220))
  2959. dxDrawLine(0.78 * DMScreenx, 0.4755 * DMScreeny, 0.95 * DMScreenx,  0.4755 * DMScreeny, tocolor(255, 255, 255, 220))
  2960.  
  2961. dxDrawText("Положение Стража", 0.785 * DMScreenx, 0.33 * DMScreeny, 0.945 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  2962. dxDrawText("Бой собак", 0.785 * DMScreenx, 0.3785 * DMScreeny, 0.945 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  2963. dxDrawText("Вынюхивать игроков", 0.785 * DMScreenx, 0.427 * DMScreeny, 0.945 * DMScreenx, 0.4755 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  2964. elseif(DMLanguage == 2)then
  2965. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  2966. dxDrawText("Задачи собак", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMTextSizex, DMTextSizey, "default-bold", "left", "center")
  2967.  
  2968. dxDrawLine(0.78 * DMScreenx, 0.33 * DMScreeny, 0.95 * DMScreenx, 0.33 * DMScreeny, tocolor(255, 255, 255, 220))
  2969. dxDrawLine(0.78 * DMScreenx, 0.3785 * DMScreeny, 0.95 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220))
  2970. dxDrawLine(0.78 * DMScreenx, 0.427 * DMScreeny, 0.95 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220))
  2971. dxDrawLine(0.78 * DMScreenx, 0.4755 * DMScreeny, 0.95 * DMScreenx,  0.4755 * DMScreeny, tocolor(255, 255, 255, 220))
  2972.  
  2973. dxDrawText("Положение Стража", 0.785 * DMScreenx, 0.33 * DMScreeny, 0.945 * DMScreenx, 0.3785 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  2974. dxDrawText("Бой собак", 0.785 * DMScreenx, 0.3785 * DMScreeny, 0.945 * DMScreenx, 0.427 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  2975. dxDrawText("Вынюхивать игроков", 0.785 * DMScreenx, 0.427 * DMScreeny, 0.945 * DMScreenx, 0.4755 * DMScreeny, tocolor(255, 255, 255, 220), DMTextSizex, DMTextSizey, "pricedown", "center", "center")
  2976. end
  2977. end
  2978.  
  2979. function DMDogTasks()
  2980. if(DMDogSpawned == true and DMPlayerInFight == false)then
  2981. removeEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  2982. DMDogPanel = false
  2983.  
  2984. guiSetVisible(DMDogPanelButton1, false)
  2985. guiSetVisible(DMDogPanelButton2, false)
  2986. guiSetVisible(DMDogPanelButton3, false)
  2987. guiSetVisible(DMDogPanelButton4, false)
  2988. guiSetVisible(DMDogPanelButton5, false)
  2989. guiSetVisible(DMDogPanelButton6, false)
  2990. guiSetVisible(DMDogPanelButton7, false)
  2991.  
  2992. guiSetVisible(DMDogTasksButton1, true)
  2993. guiSetVisible(DMDogTasksButton2, true)
  2994. guiSetVisible(DMDogTasksButton3, true)
  2995. addEventHandler("onClientRender", getRootElement(), DMDogTasksGui)
  2996. DMDogTasksPanel = true
  2997. end
  2998. end
  2999.  
  3000. function DMDogTasksInteractives()
  3001. DMDogTasksButton1 = guiCreateButton ( 0.78 * DMScreenx, 0.33 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  3002. DMDogTasksButton2 = guiCreateButton ( 0.78 * DMScreenx, 0.3785 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  3003. DMDogTasksButton3 = guiCreateButton ( 0.78 * DMScreenx, 0.427 * DMScreeny, 0.17 * DMScreenx, 0.0485 * DMScreeny, "", false)
  3004.  
  3005. guiSetAlpha(DMDogTasksButton1, 0)
  3006. guiSetAlpha(DMDogTasksButton2, 0)
  3007. guiSetAlpha(DMDogTasksButton3, 0)
  3008.  
  3009. guiSetVisible(DMDogTasksButton1, false)
  3010. guiSetVisible(DMDogTasksButton2, false)
  3011. guiSetVisible(DMDogTasksButton3, false)
  3012.  
  3013. addEventHandler ( "onClientGUIClick", DMDogTasksButton1, DMDogGuard, false )
  3014. addEventHandler ( "onClientGUIClick", DMDogTasksButton2, DMDogFight, false )
  3015. addEventHandler ( "onClientGUIClick", DMDogTasksButton3, DMDogSniff, false )
  3016. end
  3017.  
  3018. --SOUNDS
  3019. function DMAttackSound()
  3020. DMAttackSound1 = playSound("sounds/barklong.mp3", true)
  3021. triggerServerEvent("DMAttackSound", getRootElement(), DMAttacker, DMClientDog)
  3022.  
  3023. DMAttackSound1Timer = setTimer(function()
  3024. if(DMDogStatus == 3 and DMDogAttacking == true)then
  3025. local DMx, DMy, DMz = getElementPosition(getLocalPlayer())
  3026. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMClientDog)
  3027. local DMDistance = getDistanceBetweenPoints2D (DMx , DMy, DMClientDogx, DMClientDogy)
  3028. local DMVolume = 1 - DMDistance/50
  3029. if(DMVolume <= 0)then
  3030. DMVolume = 0
  3031. end
  3032. setSoundVolume(DMAttackSound1, DMVolume)
  3033. else
  3034. killTimer(DMAttackSound1Timer)
  3035. stopSound(DMAttackSound1)
  3036. local DMSound = playSound("sounds/growl.mp3", false)
  3037. setSoundVolume(DMSound, 0.3)
  3038. triggerServerEvent("DMAttackSoundStop", getRootElement(), DMAttacker)
  3039. end
  3040. end, 500, 0)
  3041. end
  3042.  
  3043. function DMAttackSoundBack(DMTriggerDog)
  3044. DMAttackSound2 = playSound("sounds/barklong.mp3", true)
  3045. DMAttackSound2Object = DMTriggerDog
  3046.  
  3047. DMAttackSound2Timer = setTimer(function()
  3048. local DMx, DMy, DMz = getElementPosition(getLocalPlayer())
  3049. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMAttackSound2Object)
  3050. local DMDistance = getDistanceBetweenPoints2D (DMx , DMy, DMClientDogx, DMClientDogy)
  3051. local DMVolume = 1 - DMDistance/50
  3052. if(DMVolume <= 0)then
  3053. DMVolume = 0
  3054. end
  3055. setSoundVolume(DMAttackSound2, DMVolume)
  3056. end, 500, 0)
  3057. end
  3058.  
  3059. function DMAttackSoundStopBack()
  3060. killTimer(DMAttackSound2Timer)
  3061. stopSound(DMAttackSound2)
  3062. end
  3063.  
  3064. function DMGuardSound()
  3065. DMGuardSound1 = playSound("sounds/barklong.mp3", true)
  3066. triggerServerEvent("DMGuardSound", getRootElement(), DMGuardPlayerFound, DMClientDog)
  3067.  
  3068. DMGuardSound1Timer = setTimer(function()
  3069. if(DMDogGuardActive ==  2)then
  3070. local DMx, DMy, DMz = getElementPosition(getLocalPlayer())
  3071. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMClientDog)
  3072. local DMDistance = getDistanceBetweenPoints2D (DMx , DMy, DMClientDogx, DMClientDogy)
  3073. local DMVolume = 1 - DMDistance/50
  3074. if(DMVolume <= 0)then
  3075. DMVolume = 0
  3076. end
  3077. setSoundVolume(DMGuardSound1, DMVolume)
  3078. else
  3079. killTimer(DMGuardSound1Timer)
  3080. stopSound(DMGuardSound1)
  3081. local DMSound = playSound("sounds/growl.mp3", false)
  3082. setSoundVolume(DMSound, 0.3)
  3083. triggerServerEvent("DMGuardSoundStop", getRootElement(), DMGuardPlayerFound)
  3084. end
  3085. end, 500, 0)
  3086. end
  3087.  
  3088. function DMGuardSoundBack(DMTriggerDog)
  3089. DMGuardSound2 = playSound("sounds/barklong.mp3", true)
  3090. DMGuardSound2Object = DMTriggerDog
  3091.  
  3092. DMGuardSound2Timer = setTimer(function()
  3093. local DMx, DMy, DMz = getElementPosition(getLocalPlayer())
  3094. local DMClientDogx, DMClientDogy, DMClientDogz = getElementPosition(DMGuardSound2Object)
  3095. local DMDistance = getDistanceBetweenPoints2D (DMx , DMy, DMClientDogx, DMClientDogy)
  3096. local DMVolume = 1 - DMDistance/50
  3097. if(DMVolume <= 0)then
  3098. DMVolume = 0
  3099. end
  3100. setSoundVolume(DMGuardSound2, DMVolume)
  3101. end, 500, 0)
  3102. end
  3103.  
  3104. function DMGuardSoundStopBack()
  3105. killTimer(DMGuardSound2Timer)
  3106. stopSound(DMGuardSound2)
  3107. end
  3108.  
  3109. --EXITS
  3110. function DMDeleteDog()
  3111. if(DMBallThrowActive == 0)then
  3112. if(DMFeedActive == 0)then
  3113. if(DMClientOwnerGotDog == true)then
  3114. if(DMDogSpawned == false)then
  3115. if(DMDogPanel == true)then
  3116. removeEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  3117. DMDogPanel = false
  3118.  
  3119. guiSetVisible(DMDogPanelButton1, false)
  3120. guiSetVisible(DMDogPanelButton2, false)
  3121. guiSetVisible(DMDogPanelButton3, false)
  3122. guiSetVisible(DMDogPanelButton4, false)
  3123. guiSetVisible(DMDogPanelButton5, false)
  3124. guiSetVisible(DMDogPanelButton6, false)
  3125. guiSetVisible(DMDogPanelButton7, false)
  3126.  
  3127. showCursor(false)
  3128. guiSetInputEnabled(false)
  3129. end
  3130. triggerServerEvent("DMDeleteDogNoSpawn", getRootElement())
  3131. if(killTimer(DMDogDeathTimer))then
  3132. end
  3133. if(DMDogDeathRevive == false)then
  3134. DMDogDeathRevive = true
  3135. killTimer(DMDogDeathTimer)
  3136. end
  3137.  
  3138. elseif(DMDogSpawned == true)then
  3139.  
  3140. local DMStopDog = true
  3141. DMExit(DMStopDog)
  3142.  
  3143. triggerServerEvent("DMDeleteDog", getRootElement(), DMDogSpawned, DMClientDog)
  3144. unbindKey(DoTrickKey,"down", DMDoTrick)
  3145. unbindKey(ChangeStatusKey,"down", DMChangeDogStatus)
  3146. end
  3147. triggerServerEvent("DMCheckOwner", getRootElement())
  3148. DMDogSpawned = false
  3149. if(DMLanguage == 1)then
  3150. outputChatBox("Собака удалена!", 255, 0,0)
  3151. elseif(DMLanguage == 2)then
  3152. outputChatBox("Собака удалена!", 255, 0,0)
  3153. end
  3154. else
  3155. if(DMLanguage == 1)then
  3156. outputChatBox("У тебя нет собаки!", 255, 0,0)
  3157. elseif(DMLanguage == 2)then
  3158. outputChatBox("У тебя нет собаки!", 255, 0,0)
  3159. end
  3160. end
  3161. else
  3162. if(DMLanguage == 1)then
  3163. outputChatBox("Подождите, пока ваша собака не съела!", 255, 0,0)
  3164. elseif(DMLanguage == 2)then
  3165. outputChatBox("Подождите, пока ваша собака не съела!", 255, 0,0)
  3166. end
  3167. end
  3168. else
  3169. if(DMLanguage == 1)then
  3170. outputChatBox("Подождите, пока ваша собака не сыграет с мячом", 255, 0,0)
  3171. elseif(DMLanguage == 2)then
  3172. outputChatBox("Подождите, пока ваша собака не сыграет с мячом", 255, 0,0)
  3173. end
  3174. end
  3175. end
  3176.  
  3177. function DMPlayerDeath()
  3178. if(source == getLocalPlayer())then
  3179.  
  3180. local DMStopDog = true
  3181. DMExit(DMStopDog)
  3182.  
  3183. unbindKey(DoTrickKey,"down", DMDoTrick)
  3184. unbindKey(ChangeStatusKey,"down", DMChangeDogStatus)
  3185. killTimer(DMDogHungerTimer)
  3186. end
  3187. end
  3188.  
  3189. function DMDogDamage(attacker, weapon, bodypart, loss)
  3190. if(source == DMClientDog)then
  3191. cancelEvent()
  3192. local DMHealth = getElementHealth(DMClientDog)
  3193. local DMNewHealth = DMHealth - loss * (1 - DMClientDogFitness / 200)
  3194. triggerServerEvent("DMDogWasted", getRootElement(), DMClientDog, DMNewHealth)
  3195.  
  3196. if(DMNewHealth <= 0)then
  3197. DMDogRevive()
  3198. end
  3199. end
  3200. end
  3201.  
  3202. function DMDogRevive()
  3203. local DMStopDog = true
  3204. DMExit(DMStopDog)
  3205. DMDogDeathRevive = false
  3206. DMDogDeathTimerCount = 0
  3207.  
  3208. DMDogDeathTimer = setTimer(function()
  3209. DMDogDeathTimerCount = DMDogDeathTimerCount + 1
  3210. if(DMDogDeathTimerCount == 180)then
  3211. DMDogDeathRevive = true
  3212. killTimer(DMDogDeathTimer)
  3213. end
  3214. end, 1000, 0)
  3215. end
  3216.  
  3217. function DMExit(DMStopDog)
  3218. if(DMTricksDogPanel == true)then
  3219. removeEventHandler("onClientRender", getRootElement(), DMTricksDogGui)
  3220. DMTricksDogPanel = false
  3221. guiSetVisible(DMTricksDogButton1, false)
  3222. guiSetVisible(DMTricksDogButton2, false)
  3223. guiSetVisible(DMTricksDogButton3, false)
  3224. guiSetVisible(DMTricksDogButton4, false)
  3225. guiSetVisible(DMTricksDogButton5, false)
  3226. guiSetVisible(DMTricksDogButton6, false)
  3227. guiSetVisible(DMTricksDogButton7, false)
  3228. showCursor(false)
  3229. guiSetInputEnabled(false)
  3230. end
  3231. if(DMTricksTutorialActive == true)then
  3232. killTimer(DMGetCoursorPosTimer)
  3233. showCursor(false)
  3234. guiSetInputEnabled(false)
  3235. removeEventHandler("onClientRender", getRootElement(), DMTricksDogTutorialGui)
  3236. DMTricksTutorialActive = false
  3237. end
  3238. if(DMDogPanel == true)then
  3239. removeEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  3240. DMDogPanel = false
  3241. if(DMClientOwnerGotDog == true)then
  3242. if(DMDogDeathRevive == true)then
  3243. guiSetVisible(DMDogPanelButton1, false)
  3244. guiSetVisible(DMDogPanelButton2, false)
  3245. guiSetVisible(DMDogPanelButton3, false)
  3246. guiSetVisible(DMDogPanelButton4, false)
  3247. guiSetVisible(DMDogPanelButton5, false)
  3248. guiSetVisible(DMDogPanelButton6, false)
  3249. guiSetVisible(DMDogPanelButton7, false)
  3250. end
  3251. end
  3252. showCursor(false)
  3253. guiSetInputEnabled(false)
  3254. end
  3255. if(DMStatusActive == true)then
  3256. removeEventHandler("onClientRender", getRootElement(), DMStatusGui)
  3257. DMStatusActive = false
  3258. end
  3259. if(DMHelpActive == true)then
  3260. removeEventHandler("onClientRender", getRootElement(), DMHelpGui)
  3261. guiSetVisible(DMHelpButton1, false)
  3262. DMHelpActive = false
  3263. showCursor(false)
  3264. guiSetInputEnabled(false)
  3265. end
  3266. if(DMDogTasksPanel == true)then
  3267. removeEventHandler("onClientRender", getRootElement(), DMDogTasksGui)
  3268. DMDogTasksPanel = false
  3269. guiSetVisible(DMDogTasksButton1, false)
  3270. guiSetVisible(DMDogTasksButton2, false)
  3271. guiSetVisible(DMDogTasksButton3, false)
  3272. showCursor(false)
  3273. guiSetInputEnabled(false)
  3274. end
  3275. if(DMDogFightPanel == true)then
  3276. removeEventHandler("onClientRender", getRootElement(), DMDogFightGui)
  3277. DMDogFightPanel = false
  3278. guiSetVisible(DMDogFightEdit, false)
  3279. guiSetVisible(DMDogFightButton, false)
  3280. showCursor(false)
  3281. guiSetInputEnabled(false)
  3282. if(DMDogSpawned == true)then
  3283. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  3284. DMStatusActive = true
  3285. end
  3286. end
  3287. if(DMDogFightRequestPanel == true)then
  3288. showCursor(false)
  3289. guiSetInputEnabled(false)
  3290. removeEventHandler("onClientRender", getRootElement(), DMDogFightRequestGui)
  3291. guiSetVisible(DMDogFightRequestButton1, false)
  3292. guiSetVisible(DMDogFightRequestButton2, false)
  3293. DMDogFightRequestPanel = false
  3294. local RequestPlayer = getPlayerFromName(DMRequestPlayer)
  3295. triggerServerEvent("DMDogFightRequestDecilned", getRootElement(), RequestPlayer)
  3296. if(DMDogSpawned == true)then
  3297. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  3298. DMStatusActive = true
  3299. end
  3300. end
  3301. if(DMDogSniffPanel == true)then
  3302. showCursor(false)
  3303. guiSetInputEnabled(false)
  3304. removeEventHandler("onClientRender", getRootElement(), DMDogSniffGui)
  3305. guiSetVisible(DMDogSniffEdit, false)
  3306. guiSetVisible(DMDogSniffButton, false)
  3307. DMDogSniffPanel = false
  3308. end
  3309. if(DMStopDog == true)then
  3310. if(DMFeedActive == 1)then
  3311. DMFeedDogExit()
  3312. DMStopFeedAnimation = true
  3313. triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  3314. DMFeedActive = 0
  3315. elseif(DMFeedActive == 2)then
  3316. killTimer(DMDogEatTimer)
  3317. DMFeedDogExit()
  3318. DMStopFeedAnimation = false
  3319. triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  3320. DMFeedActive = 0
  3321. end
  3322. if(DMBallThrowActive == 1)then
  3323. destroyElement(DMBall)
  3324. removeEventHandler("onClientPreRender",getRootElement(),DMkeepInHand)
  3325. removeEventHandler("onClientKey",getRootElement(),DMthrowBall)
  3326. removeEventHandler("onClientPlayerWeaponSwitch", getRootElement(),DMballWeaponSwitch)
  3327. DMInventoryBallExit()
  3328. elseif(DMBallThrowActive == 2)then
  3329. killTimer(DMInventoryGetBallTimer)
  3330. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  3331. destroyElement(DMBall)
  3332. removeEventHandler("onClientRender",getRootElement(),DMthrowedBall)
  3333. DMInventoryBallExit()
  3334. elseif(DMBallThrowActive == 3)then
  3335. killTimer(DMGotBallTimer)
  3336. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  3337. DMInventoryBallExit()
  3338. end
  3339. if(DMDogGuardActive == 1)then
  3340. killTimer(DMDogGuardingTimer)
  3341. destroyElement(DMDogIdleBlip)
  3342. destroyElement(DMGuardCollision)
  3343. elseif(DMDogGuardActive == 2)then
  3344. killTimer(DMDogGuardingTimer)
  3345. destroyElement(DMDogIdleBlip)
  3346. destroyElement(DMGuardCollision)
  3347. removeEventHandler("onClientRender", getRootElement(), DMDogActionGuard )
  3348. elseif(DMDogGuardActive == 3)then
  3349. killTimer(DMDogGuardingTimer)
  3350. destroyElement(DMDogIdleBlip)
  3351. destroyElement(DMGuardCollision)
  3352. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  3353. end
  3354. if(DMDogGuardActive == 1 or DMDogGuardActive == 2 or DMDogGuardActive == 3)then
  3355. DMDogGuardActive = 0
  3356. if(DMOldDogStatus == 1)then
  3357. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  3358. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  3359. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  3360. DMDogStatus = 1
  3361. DMDogIdleTimer = setTimer(function()
  3362. destroyElement(DMDogIdleBlip)
  3363. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  3364. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  3365.  
  3366. local block, anim = getPedAnimation ( DMClientDog )
  3367. if(anim ~= "OFF_Sit_Crash")then
  3368. triggerServerEvent("DMDogActionIdle", getRootElement(), DMClientDog)
  3369. end
  3370. end, 5000, 0)
  3371. elseif(DMOldDogStatus == 2)then
  3372. DMDogStatus = 2
  3373. DMDogDistanceAnimation = 0
  3374. if(DMClientDogFitness < 100)then
  3375. DMDogFitnessTimer = setTimer(function()
  3376.  if(DMClientDogFitness < 100)then
  3377.    DMClientDogFitness = DMClientDogFitness + 0.02
  3378.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  3379.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  3380.   else
  3381.    DMClientDogFitness = 100
  3382.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  3383.    killTimer(DMDogFitnessTimer)
  3384.   end
  3385. end, 15000, 0)
  3386. end
  3387. DMPositionSyncTimer = setTimer(function()
  3388. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  3389. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  3390. end, 1000, 0)
  3391. DMDogFollow = 1
  3392. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  3393. elseif(DMOldDogStatus == 3)then
  3394. DMDogStatus = 3
  3395. DMDogDistanceAnimation = 0
  3396. if(DMClientDogFitness < 100)then
  3397. DMDogFitnessTimer = setTimer(function()
  3398.  if(DMClientDogFitness < 100)then
  3399.    DMClientDogFitness = DMClientDogFitness + 0.02
  3400.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  3401.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  3402.   else
  3403.    DMClientDogFitness = 100
  3404.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  3405.    killTimer(DMDogFitnessTimer)
  3406.   end
  3407. end, 15000, 0)
  3408. end
  3409. DMPositionSyncTimer = setTimer(function()
  3410. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  3411. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  3412. end, 1000, 0)
  3413. DMDogFollow = 1
  3414. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  3415. end
  3416. end
  3417. if(DMDogStatus == 1)then
  3418. killTimer(DMDogIdleTimer)
  3419. destroyElement(DMDogIdleBlip)
  3420. elseif(DMDogStatus == 2)then
  3421. killTimer(DMPositionSyncTimer)
  3422. if(DMClientDogFitness < 100)then
  3423. killTimer(DMDogFitnessTimer)
  3424. end
  3425. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  3426.  
  3427. elseif(DMDogStatus == 3)then
  3428. killTimer(DMPositionSyncTimer)
  3429. if(DMClientDogFitness < 100)then
  3430. killTimer(DMDogFitnessTimer)
  3431. end
  3432.  
  3433. if(DMDogAttacking == true)then
  3434. DMAttackCount = 0
  3435. DMDogAttacking = false
  3436. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  3437. else
  3438. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  3439. end
  3440. elseif(DMDogStatus == 7)then
  3441. killTimer(DMPositionSyncTimer)
  3442. if(DMClientDogFitness < 100)then
  3443. killTimer(DMDogFitnessTimer)
  3444. end
  3445. DMAttackCount = 0
  3446. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  3447. stopSound(DMFightSound1)
  3448. stopSound(DMFightSound2)
  3449. end
  3450. killTimer(DMDogHungerTimer)
  3451. triggerServerEvent("DMDespawnDog", getRootElement(), DMClientDog)
  3452. DMDogSpawned = false
  3453. end
  3454. end
  3455.  
  3456. function DMExitStatus()
  3457. if(DMFeedActive == 1)then
  3458. DMFeedDogExit()
  3459. DMStopFeedAnimation = true
  3460. triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  3461. DMFeedActive = 0
  3462. elseif(DMFeedActive == 2)then
  3463. killTimer(DMDogEatTimer)
  3464. DMFeedDogExit()
  3465. DMStopFeedAnimation = false
  3466. triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  3467. DMFeedActive = 0
  3468. end
  3469. if(DMBallThrowActive == 1)then
  3470. destroyElement(DMBall)
  3471. removeEventHandler("onClientPreRender",getRootElement(),DMkeepInHand)
  3472. removeEventHandler("onClientKey",getRootElement(),DMthrowBall)
  3473. removeEventHandler("onClientPlayerWeaponSwitch", getRootElement(),DMballWeaponSwitch)
  3474. DMInventoryBallExit()
  3475. elseif(DMBallThrowActive == 2)then
  3476. killTimer(DMInventoryGetBallTimer)
  3477. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  3478. destroyElement(DMBall)
  3479. removeEventHandler("onClientRender",getRootElement(),DMthrowedBall)
  3480. DMInventoryBallExit()
  3481. elseif(DMBallThrowActive == 3)then
  3482. killTimer(DMGotBallTimer)
  3483. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  3484. DMInventoryBallExit()
  3485. end
  3486. if(DMDogStatus == 1)then
  3487. killTimer(DMDogIdleTimer)
  3488. destroyElement(DMDogIdleBlip)
  3489. elseif(DMDogStatus == 2)then
  3490. killTimer(DMPositionSyncTimer)
  3491. if(DMClientDogFitness < 100)then
  3492. killTimer(DMDogFitnessTimer)
  3493. end
  3494. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  3495.  
  3496. elseif(DMDogStatus == 3)then
  3497. killTimer(DMPositionSyncTimer)
  3498. if(DMClientDogFitness < 100)then
  3499. killTimer(DMDogFitnessTimer)
  3500. end
  3501.  
  3502. if(DMDogAttacking == true)then
  3503. DMAttackCount = 0
  3504. DMDogAttacking = false
  3505. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  3506. else
  3507. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  3508. end
  3509. elseif(DMDogStatus == 7)then
  3510. killTimer(DMPositionSyncTimer)
  3511. if(DMClientDogFitness < 100)then
  3512. killTimer(DMDogFitnessTimer)
  3513. end
  3514. DMAttackCount = 0
  3515. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  3516. stopSound(DMFightSound1)
  3517. stopSound(DMFightSound2)
  3518. local DMSound = playSound("sounds/growl.mp3", false)
  3519. setSoundVolume(DMSound, 0.3)
  3520. end
  3521. end
  3522.  
  3523.  
  3524. --HELP
  3525. function DMHelp()
  3526. if(DMHelpActive == false)then
  3527. removeEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  3528. DMDogPanel = false
  3529.  
  3530. guiSetVisible(DMDogPanelButton1, false)
  3531. guiSetVisible(DMDogPanelButton2, false)
  3532. guiSetVisible(DMDogPanelButton3, false)
  3533. guiSetVisible(DMDogPanelButton4, false)
  3534. guiSetVisible(DMDogPanelButton5, false)
  3535. guiSetVisible(DMDogPanelButton6, false)
  3536. guiSetVisible(DMDogPanelButton7, false)
  3537.  
  3538. DMHelpActive = true
  3539.  
  3540. addEventHandler("onClientRender", getRootElement(), DMHelpGui)
  3541. guiSetVisible(DMHelpButton1, true)
  3542. elseif(DMHelpActive == true)then
  3543. removeEventHandler("onClientRender", getRootElement(), DMHelpGui)
  3544. guiSetVisible(DMHelpButton1, false)
  3545. DMHelpActive = false
  3546.  
  3547. addEventHandler("onClientRender", getRootElement(), DMDogPanelGui)
  3548. DMDogPanel = true
  3549.  
  3550. guiSetVisible(DMDogPanelButton1, true)
  3551. guiSetVisible(DMDogPanelButton2, true)
  3552. guiSetVisible(DMDogPanelButton3, true)
  3553. guiSetVisible(DMDogPanelButton4, true)
  3554. guiSetVisible(DMDogPanelButton5, true)
  3555. guiSetVisible(DMDogPanelButton6, true)
  3556. guiSetVisible(DMDogPanelButton7, true)
  3557. end
  3558. end
  3559.  
  3560. local DMHelpTextSizex = DMScreenx/1920
  3561. local DMHelpTextSizey = DMScreeny/1080
  3562. function DMHelpGui()
  3563. if(DMLanguage == 1)then
  3564. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  3565. dxDrawText("DogMod Help", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3566.  
  3567. dxDrawText("About:", 0.785 * DMScreenx, 0.33 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3568. dxDrawText("This Mod finally allows you to create your own Dog in MTA! Check for Updates on the mtasa.com page from Dog Mod by SuperBrandy", 0.79 * DMScreenx, 0.36 * DMScreeny, 0.941 * DMScreenx, 0.36 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center",false, true)
  3569.  
  3570. dxDrawText("Commands:", 0.785 * DMScreenx, 0.39 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3571. dxDrawText("/dog - create dog", 0.79 * DMScreenx, 0.405 * DMScreeny, 0.941 * DMScreenx, 0.405 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3572. dxDrawText("/deletedog - delete dog", 0.79 * DMScreenx, 0.42 * DMScreeny, 0.941 * DMScreenx, 0.42 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3573. dxDrawText(DogPanelKey.." - open dog panel", 0.79 * DMScreenx, 0.435 * DMScreeny, 0.941 * DMScreenx, 0.435 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3574.  
  3575. dxDrawText("Actions:", 0.785 * DMScreenx, 0.45 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3576. dxDrawText(ChangeStatusKey..": Change dog status", 0.79 * DMScreenx, 0.465 * DMScreeny, 0.941 * DMScreenx, 0.465 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3577. dxDrawText(DoTrickKey..": Do trick", 0.79 * DMScreenx, 0.48 * DMScreeny, 0.941 * DMScreenx, 0.48 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3578. dxDrawText("Idle: Your dog keeps waiting at one point", 0.79 * DMScreenx, 0.495 * DMScreeny, 0.941 * DMScreenx, 0.495 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3579. dxDrawText("Following: Your dog is following you", 0.79 * DMScreenx, 0.51 * DMScreeny, 0.941 * DMScreenx, 0.51 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3580. dxDrawText("Attacking: Your dog guards you from attacks and helps you by attacking others", 0.79 * DMScreenx, 0.532 * DMScreeny, 0.941 * DMScreenx, 0.532 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3581.  
  3582. dxDrawText("Statistics:", 0.785 * DMScreenx, 0.555 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3583. dxDrawText("Fitness: Increases the Health of your dog, gained by walking. Unlocks tricks", 0.79 * DMScreenx, 0.575 * DMScreeny, 0.941 * DMScreenx, 0.575 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3584. dxDrawText("Strength: Increases the Damage your dog does, gained by attacking", 0.79 * DMScreenx, 0.605 * DMScreeny, 0.941 * DMScreenx, 0.605 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3585.  
  3586. dxDrawImage(0.9 * DMScreenx, 0.62 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  3587. dxDrawText("Done", 0.9 * DMScreenx, 0.623 * DMScreeny, DMScreenx * 0.942, DMScreeny * 0.663, tocolor(0, 0, 0, 220), DMHelpTextSizey * 0.7, DMHelpTextSizey * 0.7, "beckett", "center", "center")
  3588. elseif(DMLanguage == 2)then
  3589. dxDrawRectangle(0.78 * DMScreenx, 0.3 * DMScreeny, 0.17 * DMScreenx, 0.37 * DMScreeny, tocolor(20, 20, 20, 220))
  3590. dxDrawText("DogMod Hilfe", 0.785 * DMScreenx, 0.315 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3591.  
  3592. dxDrawText("Über:", 0.785 * DMScreenx, 0.33 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3593. dxDrawText("Dieser Mod bringt Hunde in deine MTA Welt! Neue Updates sind auf der mtasa.com Website -DogMod by SuperBrandy- zu finden", 0.79 * DMScreenx, 0.36 * DMScreeny, 0.941 * DMScreenx, 0.36 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center",false, true)
  3594.  
  3595. dxDrawText("Befehle:", 0.785 * DMScreenx, 0.39 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3596. dxDrawText("/dog - Создать собаку", 0.79 * DMScreenx, 0.405 * DMScreeny, 0.941 * DMScreenx, 0.405 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3597. dxDrawText("/deletedog - Удалить собаку", 0.79 * DMScreenx, 0.42 * DMScreeny, 0.941 * DMScreenx, 0.42 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3598. dxDrawText(DogPanelKey.." - Hunde Panel öffnen", 0.79 * DMScreenx, 0.435 * DMScreeny, 0.941 * DMScreenx, 0.435 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3599.  
  3600. dxDrawText("Aktionen:", 0.785 * DMScreenx, 0.45 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3601. dxDrawText(ChangeStatusKey..": Status des Hundes ändern", 0.79 * DMScreenx, 0.465 * DMScreeny, 0.941 * DMScreenx, 0.465 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3602. dxDrawText(DoTrickKey..": Tricks ausführen", 0.79 * DMScreenx, 0.48 * DMScreeny, 0.941 * DMScreenx, 0.48 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3603. dxDrawText("Wartend: Dein Hund wartet an einem Punkt", 0.79 * DMScreenx, 0.495 * DMScreeny, 0.941 * DMScreenx, 0.495 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3604. dxDrawText("Folgen: Dein Hund folgt dir", 0.79 * DMScreenx, 0.51 * DMScreeny, 0.941 * DMScreenx, 0.51 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3605. dxDrawText("Attackieren: Dein Hund greift an und beschützt dich", 0.79 * DMScreenx, 0.525 * DMScreeny, 0.941 * DMScreenx, 0.525 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3606.  
  3607. dxDrawText("Statistiken:", 0.785 * DMScreenx, 0.555 * DMScreeny, nil, nil, tocolor(DMClientDogGenderColorR, DMClientDogGenderColorG, DMClientDogGenderColorB, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center")
  3608. dxDrawText("Fitness: Erhöht das Leben deines Hundes durch laufen. Schaltet Tricks frei", 0.79 * DMScreenx, 0.575 * DMScreeny, 0.941 * DMScreenx, 0.575 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3609. dxDrawText("Stärke: Erhöht den Schaden deines Hundes, erhöht sich durch Attacken", 0.79 * DMScreenx, 0.605 * DMScreeny, 0.941 * DMScreenx, 0.605 * DMScreeny, tocolor(255, 255, 255, 220), DMHelpTextSizey, DMHelpTextSizey, "default-bold", "left", "center", false, true)
  3610.  
  3611. dxDrawImage(0.9 * DMScreenx, 0.62 * DMScreeny, 80 * DMImagex, 50 * DMImagey, texture5  )
  3612. dxDrawText("Fertig", 0.9 * DMScreenx, 0.623 * DMScreeny, DMScreenx * 0.942, DMScreeny * 0.663, tocolor(0, 0, 0, 220), DMHelpTextSizey * 0.7, DMHelpTextSizey * 0.7, "beckett", "center", "center")
  3613. end
  3614. end
  3615.  
  3616. function DMHelpInteractives()
  3617. DMHelpButton1 = guiCreateButton ( 0.9 * DMScreenx, 0.623 * DMScreeny, 0.042 * DMScreenx, 0.04 * DMScreeny, "", false)
  3618. guiSetAlpha(DMHelpButton1, 0)
  3619. guiSetVisible(DMHelpButton1, false)
  3620. addEventHandler ( "onClientGUIClick", DMHelpButton1, DMHelp, false )
  3621. end
  3622.  
  3623.  
  3624. --CHEATS
  3625. function DMUnlockAll()
  3626. if(EnableCheats == true)then
  3627. if(DMClientOwnerGotDog == true)then
  3628. if(DMDogSpawned == false)then
  3629. DMClientDogFitness = 100
  3630. triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  3631. DMClientDogStrength = 100
  3632. triggerServerEvent("DMSaveStatStrength", getRootElement(), DMClientDogStrength)
  3633. else
  3634. if(DMLanguage == 1)then
  3635. outputChatBox("Сначала убери свою собаку", 255,0,0)
  3636. elseif(DMLanguage == 2)then
  3637. outputChatBox("Сначала убери свою собаку", 255,0,0)
  3638. end
  3639. end
  3640. else
  3641. if(DMLanguage == 1)then
  3642. outputChatBox("У тебя нет собаки", 255,0,0)
  3643. elseif(DMLanguage == 2)then
  3644. outputChatBox("У тебя нет собаки", 255,0,0)
  3645. end
  3646. end
  3647. else
  3648. if(DMLanguage == 1)then
  3649. outputChatBox("Коды отключены", 255,0,0)
  3650. elseif(DMLanguage == 2)then
  3651. outputChatBox("Коды отключены", 255,0,0)
  3652. end
  3653. end
  3654. end
  3655.  
  3656. --LANGUAGE
  3657.  
  3658.        
  3659. --.Handler.--
  3660.  
  3661. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  3662.     function ()
  3663.     -- load dogs   
  3664.     --SHEPERD        
  3665.       txd = engineLoadTXD("skins/txd/germansheperdblack.txd")
  3666.       engineImportTXD(txd, 290)
  3667.       dff = engineLoadDFF("skins/dff/germansheperd.dff", 290)
  3668.       engineReplaceModel(dff, 290)
  3669.      
  3670.       txd = engineLoadTXD("skins/txd/germansheperdblackwhite.txd")
  3671.       engineImportTXD(txd, 291)
  3672.       dff = engineLoadDFF("skins/dff/germansheperd.dff", 291)
  3673.       engineReplaceModel(dff, 291)
  3674.    
  3675.       txd = engineLoadTXD("skins/txd/germansheperdblackbrown.txd")
  3676.       engineImportTXD(txd, 292)
  3677.       dff = engineLoadDFF("skins/dff/germansheperd.dff", 292)
  3678.       engineReplaceModel(dff, 292)
  3679.      
  3680.     --PITBULL
  3681.       txd = engineLoadTXD("skins/txd/pitbullbrown.txd")
  3682.       engineImportTXD(txd, 293)
  3683.       dff = engineLoadDFF("skins/dff/pitbull1.dff", 293)
  3684.       engineReplaceModel(dff, 293)
  3685.        
  3686.       txd = engineLoadTXD("skins/txd/pitbullwhite.txd")
  3687.       engineImportTXD(txd, 294)
  3688.       dff = engineLoadDFF("skins/dff/pitbull1.dff", 294)
  3689.       engineReplaceModel(dff, 294)
  3690.      
  3691.       txd = engineLoadTXD("skins/txd/pitbullgrey.txd")
  3692.       engineImportTXD(txd, 295)
  3693.       dff = engineLoadDFF("skins/dff/pitbull1.dff", 295)
  3694.       engineReplaceModel(dff, 295)
  3695.        
  3696.       txd = engineLoadTXD("skins/txd/pitbullblackwhite.txd")
  3697.       engineImportTXD(txd, 296)
  3698.       dff = engineLoadDFF("skins/dff/pitbull2.dff", 296)
  3699.       engineReplaceModel(dff, 296)
  3700.                
  3701.     --GOLDERRETRIEVER
  3702.       txd = engineLoadTXD("skins/txd/goldenretrieverbrown.txd")
  3703.       engineImportTXD(txd, 297)
  3704.       dff = engineLoadDFF("skins/dff/goldenretriever.dff", 297)
  3705.       engineReplaceModel(dff, 297)  
  3706.      
  3707.       txd = engineLoadTXD("skins/txd/goldenretrieverwhite.txd")
  3708.       engineImportTXD(txd, 298)
  3709.       dff = engineLoadDFF("skins/dff/goldenretriever.dff", 298)
  3710.       engineReplaceModel(dff, 298)  
  3711.    
  3712.     --ROTTWEILER
  3713.       txd = engineLoadTXD("skins/txd/rottweiler.txd")
  3714.       engineImportTXD(txd, 299)
  3715.       dff = engineLoadDFF("skins/dff/rottweiler.dff", 299)
  3716.       engineReplaceModel(dff, 299)  
  3717.      
  3718.     -- load textures
  3719.         texture1 = dxCreateTexture("textures/sheperd.png" , "argb", true,"clamp" )
  3720.         texture2 = dxCreateTexture("textures/pitbull.png" , "argb", true,"clamp" )
  3721.         texture3 = dxCreateTexture("textures/goldenretriever.png" , "argb", true,"clamp" )
  3722.         texture4 = dxCreateTexture("textures/rottweiler.png" , "argb", true,"clamp" )
  3723.         texture5 = dxCreateTexture("textures/button.png" , "argb", true,"clamp" )
  3724.         texture6 = dxCreateTexture("textures/buttonfalse.png" , "argb", true,"clamp" )
  3725.         texture7 = dxCreateTexture("textures/male.png" , "argb", true,"clamp" )
  3726.         texture8 = dxCreateTexture("textures/female.png" , "argb", true,"clamp" )
  3727.        
  3728.         bindKey(DogPanelKey, "down", DMDogPanel)
  3729.        
  3730.         DMDogPanel = false
  3731.         DMFeedActive = 0
  3732.         DMDogAttacking = false
  3733.         DMDogHunger = 100
  3734.         DMDogSpawned = false
  3735.         DMHelpActive = false
  3736.         DMTricksDogPanel = false
  3737.         DMTricksTutorialActive = false
  3738.         DMStatusActive = false
  3739.         DMDogDeathRevive = true
  3740.         DMBallThrowActive = 0
  3741.         DMCreatorActive = false
  3742.         DMDogTasksPanel = false
  3743.         DMDogFightPanel = false
  3744.         DMDogDeathRevive = true
  3745.         DMDogFightRequestPanel = false
  3746.         DMOnlySpawn = false
  3747.         DMPlayerInFight = false
  3748.         DMRequestClose = false
  3749.         DMAttackSound2 = false
  3750.         DMDogSniffPanel = false
  3751.        
  3752.         local DMroom = createObject ( 14865, 0, 0, 0, 0, 0, 0 )
  3753.         setElementInterior ( DMroom, 20, 0, 0, 0)
  3754.        
  3755.         local DMtable = createObject ( 2762 , 0.1, 0.5, -1.6, 0, 0, 0 )
  3756.         setElementInterior ( DMtable, 20, 0.1, 0.5, -1.6)
  3757.        
  3758.         DMDogCreatorPed = createPed ( 290 , 0.1, 0.3, -0.2 , 90)
  3759.         setElementInterior ( DMDogCreatorPed, 20, 0.1, 0.3, -0.2)
  3760.        
  3761.         triggerServerEvent("DMCheckOwner", getRootElement())
  3762.        
  3763.         DMDogCreationInteractives()
  3764.         DMDogPanelInteractives()
  3765.         DMHelpInteractives()
  3766.         DMTricksDogInteractives()
  3767.         DMDogTasksInteractives()
  3768.         DMDogFightInteractives()
  3769.         DMDogFightRequestInteractives()
  3770.         DMDogSniffInteractives()
  3771.        
  3772.         if(Language == "English")then
  3773.           DMLanguage = 1
  3774.         elseif(Language == "German")then
  3775.           DMLanguage = 2
  3776.         end
  3777.                
  3778.         outputChatBox ( "#00CCFFDogMod #FFFFFFзагружен, доступ с "..DogPanelKey, 255, 255, 255, true )
  3779.     end
  3780.     )
  3781.  
  3782. addCommandHandler("dog", DMCreateDog)
  3783. addCommandHandler("deletedog", DMDeleteDog)
  3784. addCommandHandler("unlockall", DMUnlockAll)
  3785.  
  3786. addEvent( "DMCheckOwnerBack", true )
  3787. addEventHandler( "DMCheckOwnerBack", getRootElement(), DMCheckOwnerBack )
  3788.  
  3789. addEvent( "DMSpawnDogBack", true )
  3790. addEventHandler( "DMSpawnDogBack", getRootElement(), DMSpawnDogBack )
  3791.  
  3792. addEvent( "DMFeedDogBack", true )
  3793. addEventHandler( "DMFeedDogBack", getRootElement(), DMFeedDogBack )
  3794.  
  3795. addEvent( "DMCheckAttackAttacker", true )
  3796. addEventHandler( "DMCheckAttackAttacker", getRootElement(), DMCheckAttackAttacker )
  3797.  
  3798. addEvent( "DMDogActionAttackStop", true )
  3799. addEventHandler( "DMDogActionAttackStop", getRootElement(), DMDogActionAttackStop )
  3800.  
  3801. addEvent( "DMDogFightRequestBack", true )
  3802. addEventHandler( "DMDogFightRequestBack", getRootElement(), DMDogFightRequestBack )
  3803.  
  3804. addEvent("DMDogFightRequestFailed", true)
  3805. addEventHandler("DMDogFightRequestFailed", getRootElement(), DMDogFightRequestFailed)
  3806.  
  3807. addEvent("DMDogFightRequestSent", true)
  3808. addEventHandler("DMDogFightRequestSent", getRootElement(), DMDogFightRequestSent)
  3809.  
  3810. addEvent("DMDogFightRequestDecilnedBack", true)
  3811. addEventHandler("DMDogFightRequestDecilnedBack", getRootElement(), DMDogFightRequestDecilnedBack)
  3812.  
  3813. addEvent("DMDogFightWin", true)
  3814. addEventHandler("DMDogFightWin", getRootElement(), DMDogFightWin)
  3815.  
  3816. addEvent("DMDogFightLose", true)
  3817. addEventHandler("DMDogFightLose", getRootElement(), DMDogFightLose)
  3818.  
  3819. addEvent("DMDogsFightStartBack", true)
  3820. addEventHandler("DMDogsFightStartBack", getRootElement(), DMDogsFightStartBack)
  3821.  
  3822. addEvent("DMDogsFightGiveUpBack", true)
  3823. addEventHandler("DMDogsFightGiveUpBack", getRootElement(), DMDogsFightGiveUpBack)
  3824.  
  3825. addEvent("DMAttackSoundBack", true)
  3826. addEventHandler("DMAttackSoundBack", getRootElement(), DMAttackSoundBack)
  3827.  
  3828. addEvent("DMAttackSoundStopBack", true)
  3829. addEventHandler("DMAttackSoundStopBack", getRootElement(), DMAttackSoundStopBack)
  3830.  
  3831. addEvent("DMGuardSoundBack", true)
  3832. addEventHandler("DMGuardSoundBack", getRootElement(), DMGuardSoundBack)
  3833.  
  3834. addEvent("DMGuardSoundStopBack", true)
  3835. addEventHandler("DMGuardSoundStopBack", getRootElement(), DMGuardSoundStopBack)
  3836.  
  3837. addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), DMPlayerDeath )
  3838. addEventHandler ( "onClientPlayerDamage", getRootElement(), DMCheckAttack )
  3839.  
  3840. addEventHandler ( "onClientPedDamage", getRootElement(), DMDogDamage )
  3841.  
  3842. --IN CAR
  3843.  
  3844. addEventHandler("onClientPlayerVehicleEnter",getRootElement(),
  3845. function()
  3846. if(source == getLocalPlayer())then
  3847. if(DMDogSpawned == false)then
  3848. local DMStopDog = false
  3849. DMExit(DMStopDog)
  3850. elseif(DMDogSpawned == true)then
  3851. local DMStopDog = false
  3852. DMExit(DMStopDog)
  3853. addEventHandler("onClientRender", getRootElement(), DMStatusGui)
  3854. DMStatusActive = true
  3855. local DMVehicle = getPedOccupiedVehicle(source)
  3856. local DMVehicleType = getVehicleType (DMVehicle)
  3857.  
  3858. local DMSeat
  3859. if(DMVehicleType == "Automobile" or DMVehicleType == "Helicopter" or DMVehicleType == "Monster Truck")then
  3860. local DMSeats = getVehicleMaxPassengers (DMVehicle)
  3861. if(DMSeats == 0)then
  3862. DMSeat = 0
  3863. end
  3864. if(DMSeats == 1)then
  3865. if(getVehicleOccupant ( DMVehicle, 1 ) == false)then
  3866. DMSeat = 1
  3867. else
  3868. DMSeat = 0
  3869. end
  3870. end
  3871. if(DMSeats == 2)then
  3872. if(getVehicleOccupant ( DMVehicle, 1 ) == false)then
  3873. DMSeat = 1
  3874. elseif(getVehicleOccupant ( DMVehicle, 2 ) == false)then
  3875. DMSeat = 2
  3876. else
  3877. DMSeat = 0
  3878. end
  3879. end
  3880. if(DMSeats == 3)then
  3881. if(getVehicleOccupant ( DMVehicle, 1 ) == false)then
  3882. DMSeat = 1
  3883. elseif(getVehicleOccupant ( DMVehicle, 2 ) == false)then
  3884. DMSeat = 2
  3885. elseif(getVehicleOccupant ( DMVehicle, 3 ) == false)then
  3886. DMSeat = 3
  3887. else
  3888. DMSeat = 0
  3889. end
  3890. end
  3891. if(DMSeats == 4)then
  3892. if(getVehicleOccupant ( DMVehicle, 1 ) == false)then
  3893. DMSeat = 1
  3894. elseif(getVehicleOccupant ( DMVehicle, 2 ) == false)then
  3895. DMSeat = 2
  3896. elseif(getVehicleOccupant ( DMVehicle, 3 ) == false)then
  3897. DMSeat = 3
  3898. elseif(getVehicleOccupant ( DMVehicle, 4 ) == false)then
  3899. DMSeat = 4
  3900. else
  3901. DMSeat = 0
  3902. end
  3903. end
  3904. if(DMSeats == 5)then
  3905. if(getVehicleOccupant ( DMVehicle, 1 ) == false)then
  3906. DMSeat = 1
  3907. elseif(getVehicleOccupant ( DMVehicle, 2 ) == false)then
  3908. DMSeat = 2
  3909. elseif(getVehicleOccupant ( DMVehicle, 3 ) == false)then
  3910. DMSeat = 3
  3911. elseif(getVehicleOccupant ( DMVehicle, 4 ) == false)then
  3912. DMSeat = 4
  3913. elseif(getVehicleOccupant ( DMVehicle, 5 ) == false)then
  3914. DMSeat = 5
  3915. else
  3916. DMSeat = 0
  3917. end
  3918. end
  3919. if(DMSeats == 6)then
  3920. if(getVehicleOccupant ( DMVehicle, 1 ) == false)then
  3921. DMSeat = 1
  3922. elseif(getVehicleOccupant ( DMVehicle, 2 ) == false)then
  3923. DMSeat = 2
  3924. elseif(getVehicleOccupant ( DMVehicle, 3 ) == false)then
  3925. DMSeat = 3
  3926. elseif(getVehicleOccupant ( DMVehicle, 4 ) == false)then
  3927. DMSeat = 4
  3928. elseif(getVehicleOccupant ( DMVehicle, 5) == false)then
  3929. DMSeat = 5
  3930. elseif(getVehicleOccupant ( DMVehicle, 6 ) == false)then
  3931. DMSeat = 6
  3932. else
  3933. DMSeat = 0
  3934. end
  3935. end
  3936. if(DMSeats == 7)then
  3937. if(getVehicleOccupant ( DMVehicle, 1 ) == false)then
  3938. DMSeat = 1
  3939. elseif(getVehicleOccupant ( DMVehicle, 2 ) == false)then
  3940. DMSeat = 2
  3941. elseif(getVehicleOccupant ( DMVehicle, 3 ) == false)then
  3942. DMSeat = 3
  3943. elseif(getVehicleOccupant ( DMVehicle, 4 ) == false)then
  3944. DMSeat = 4
  3945. elseif(getVehicleOccupant ( DMVehicle, 5) == false)then
  3946. DMSeat = 5
  3947. elseif(getVehicleOccupant ( DMVehicle, 6 ) == false)then
  3948. DMSeat = 6
  3949. elseif(getVehicleOccupant ( DMVehicle, 7 ) == false)then
  3950. DMSeat = 7
  3951. else
  3952. DMSeat = 0
  3953. end
  3954. end
  3955. if(DMSeats == 8)then
  3956. if(getVehicleOccupant ( DMVehicle, 1 ) == false)then
  3957. DMSeat = 1
  3958. elseif(getVehicleOccupant ( DMVehicle, 2 ) == false)then
  3959. DMSeat = 2
  3960. elseif(getVehicleOccupant ( DMVehicle, 3 ) == false)then
  3961. DMSeat = 3
  3962. elseif(getVehicleOccupant ( DMVehicle, 4 ) == false)then
  3963. DMSeat = 4
  3964. elseif(getVehicleOccupant ( DMVehicle, 5) == false)then
  3965. DMSeat = 5
  3966. elseif(getVehicleOccupant ( DMVehicle, 6 ) == false)then
  3967. DMSeat = 6
  3968. elseif(getVehicleOccupant ( DMVehicle, 7 ) == false)then
  3969. DMSeat = 7
  3970. elseif(getVehicleOccupant ( DMVehicle, 8 ) == false)then
  3971. DMSeat = 8
  3972. else
  3973. DMSeat = 0
  3974. end
  3975. end
  3976. else
  3977. DMSeat = 0
  3978. end
  3979.  
  3980.  
  3981. if(DMFeedActive == 1)then
  3982. DMFeedDogExit()
  3983. DMStopFeedAnimation = true
  3984. triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  3985. DMFeedActive = 0
  3986. elseif(DMFeedActive == 2)then
  3987. killTimer(DMDogEatTimer)
  3988. DMFeedDogExit()
  3989. DMStopFeedAnimation = false
  3990. triggerServerEvent("DMFeedDogFinished", getRootElement(), DMStopFeedAnimation)
  3991. DMFeedActive = 0
  3992. end
  3993.  
  3994. if(DMBallThrowActive == 1)then
  3995. destroyElement(DMBall)
  3996. removeEventHandler("onClientPreRender",getRootElement(),DMkeepInHand)
  3997. removeEventHandler("onClientKey",getRootElement(),DMthrowBall)
  3998. removeEventHandler("onClientPlayerWeaponSwitch", getRootElement(),DMballWeaponSwitch)
  3999. DMInventoryBallExit()
  4000. elseif(DMBallThrowActive == 2)then
  4001. killTimer(DMInventoryGetBallTimer)
  4002. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  4003. destroyElement(DMBall)
  4004. removeEventHandler("onClientRender",getRootElement(),DMthrowedBall)
  4005. DMInventoryBallExit()
  4006. elseif(DMBallThrowActive == 3)then
  4007. killTimer(DMGotBallTimer)
  4008. removeEventHandler("onClientRender",getRootElement(),DMDogActionFollow)
  4009. DMInventoryBallExit()
  4010. end
  4011.  
  4012. if(DMDogStatus == 2 )then
  4013. removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  4014. local DMPlayerInVehicle = true
  4015. killTimer(DMDogFitnessTimer)
  4016. killTimer(DMPositionSyncTimer)
  4017.  
  4018. triggerServerEvent("DMOwnerCar", getRootElement(), DMPlayerInVehicle, DMClientDog,DMx, DMy, DMz, DMVehicle, DMSeat)
  4019. elseif(DMDogStatus == 3)then
  4020. if(removeEventHandler("onClientRender", getRootElement(), DMDogActionFollow ))then
  4021. else
  4022. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  4023. DMDogAttacking = false
  4024. end
  4025. local DMPlayerInVehicle = true
  4026. killTimer(DMDogFitnessTimer)
  4027. killTimer(DMPositionSyncTimer)
  4028. triggerServerEvent("DMOwnerCar", getRootElement(), DMPlayerInVehicle, DMClientDog,DMx, DMy, DMz, DMVehicle, DMSeat)
  4029. elseif(DMDogStatus == 7)then
  4030. local DMPlayerInVehicle = true
  4031. removeEventHandler("onClientRender", getRootElement(), DMDogActionAttack)
  4032. DMDogAttacking = false
  4033. killTimer(DMDogFitnessTimer)
  4034. killTimer(DMPositionSyncTimer)
  4035. stopSound(DMFightSound1)
  4036. stopSound(DMFightSound2)
  4037. if(DMLanguage == 1)then
  4038. outputChatBox("You gave up the fight", 255,255,0)
  4039. elseif(DMLanguage == 2)then
  4040. outputChatBox("Du hast den Kampf aufgegeben", 255,255,0)
  4041. end
  4042. local DMTriggerPlayer = getPlayerFromName(DMRequestPlayer)
  4043. triggerServerEvent("DMDogsFightGiveUp", getRootElement(), DMTriggerPlayer)
  4044. DMDogStatus = 3
  4045. triggerServerEvent("DMOwnerCar", getRootElement(), DMPlayerInVehicle, DMClientDog,DMx, DMy, DMz, DMVehicle, DMSeat)
  4046. end
  4047. end
  4048. end
  4049. end)
  4050.  
  4051. addEventHandler("onClientPlayerVehicleExit",getRootElement(),
  4052. function()
  4053. if(source == getLocalPlayer())then
  4054. if(DMDogSpawned == true)then
  4055. if(DMDogStatus == 2 or DMDogStatus == 3)then
  4056. local DMPlayerInVehicle = false
  4057.  
  4058. DMPositionSyncTimer = setTimer(function()
  4059. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  4060. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  4061. end, 1000, 0)
  4062.  
  4063. if(DMClientDogFitness < 100)then
  4064. DMDogFitnessTimer = setTimer(function()
  4065.   if(DMClientDogFitness < 100)then
  4066.    DMClientDogFitness = DMClientDogFitness + 0.2
  4067.    DMClientDogFitness = DMRound(DMClientDogFitness, 10)
  4068.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  4069.   else
  4070.    DMClientDogFitness = 100
  4071.    triggerServerEvent("DMSaveStatFitness", getRootElement(), DMClientDogFitness)
  4072.    killTimer(DMDogFitnessTimer)
  4073.   end
  4074. end, 15000, 0)
  4075. end
  4076.  
  4077. local DMx, DMy, DMz = getElementPosition(getLocalPlayer())
  4078. DMDogDistanceAnimation = 0
  4079. DMDogFollow = 1
  4080. addEventHandler("onClientRender", getRootElement(), DMDogActionFollow )
  4081. triggerServerEvent("DMOwnerCar", getRootElement(), DMPlayerInVehicle, DMClientDog, DMx, DMy, DMz)
  4082. end
  4083. end
  4084. end
  4085. end)
  4086.  
  4087. --POSITION SYNC
  4088. addEventHandler ( "onClientPedDamage", getRootElement(),
  4089. function()
  4090. if(source == DMClientDog)then
  4091. local Dogx, Dogy, Dogz = getElementPosition(DMClientDog)
  4092. triggerServerEvent("DMSyncPosition", getRootElement(),DMClientDog, Dogx, Dogy, Dogz)
  4093. if(DMDogStatus == 1)then
  4094. destroyElement(DMDogIdleBlip)
  4095. DMDogIdleBlip = createBlip ( Dogx, Dogy, Dogz , 0, 2, 255, 255, 255, 255, 0, 250)
  4096. end
  4097. end
  4098. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top