Advertisement
Guest User

panel problem

a guest
Dec 2nd, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 70.16 KB | None | 0 0
  1. [code=lua] 
  2. function onresource2Start()
  3.     customHorn = {}
  4.     hornNum = 0
  5.     setHornSound = 0
  6.     bindKey ("f7", "down", registredor)
  7.     triggerServerEvent("setPlayerPanelIstatistik",getLocalPlayer())
  8.     addEventHandler ( "onClientGUIClick", gRoot, Buttons )
  9.     addEventHandler ( "onClientGUIClick", btnPreviewHorn, hornPreview, false )
  10.     addEventHandler ( "onClientGUIClick", btnSetHornSound, setHornCheck, false )
  11.     addEventHandler ( "onClientGUIClick", btnBuyHorn, buyHorn, false )
  12.     addEventHandler ( "onClientGUIClick", gridHorns, updateHornPriceLabel, false )
  13.     addEventHandler ( "onClientGUIClick", Gui_Sol, sam, false )
  14.     addEventHandler ( "onClientGUIClick", Gui_Sag, sol, false )
  15.     addEventHandler ( "onClientGUIClick", Gui_Jantbuy, save, false )
  16.     addEventHandler ( "onClientGUIClick", sendButxxs, giveMoney, false )
  17.    
  18.  
  19.    
  20.  
  21. end
  22. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresource2Start)
  23.  
  24. function removeColorCoding (name)
  25. return type(name)=="string" and string.gsub(name, "#%x%x%x%x%x%x", "") or name
  26. end
  27.  
  28.  
  29.  
  30.  
  31. function onresource2Startx22x()
  32.     customHorn = {}
  33.     hornNum = 0
  34.     setHornSound = 0
  35. end
  36.  
  37.  
  38.  
  39. function registredor()
  40.     triggerServerEvent("setPlayerPanelIstatistik",getLocalPlayer())
  41.     triggerServerEvent ("iAmLoggedIn", getLocalPlayer())
  42.     addEventHandler ( "onClientGUIClick", gRoot, Buttons )
  43. end
  44. function setPlayerPanelIstatistik(para,dmoyun,dmkazan,point,rank,rankx,ddoyun,ddkazan,play,son,dmoran,ddoran,hunter)
  45.  
  46. -- kasim 1
  47. guiSetText(serkan1,""..tostring(para).."$")
  48. guiSetText(serkanzx,tostring(dmoyun))
  49. guiSetText(serkan3,tostring(dmkazan))
  50. guiSetText(serkan4,tostring(point))
  51. guiSetText(serkan5,tostring(rank))
  52. guiSetText(serkan6,tostring(rankx))
  53. guiSetText(serkan7,tostring(ddoyun))
  54. guiSetText(serkan8,tostring(ddkazan))
  55. --kasim 2
  56. guiSetText(serkan9,""..tostring(play).."dk")
  57. guiSetText(serkan10,tostring(son))
  58. guiSetText(serkan11,""..tostring(dmoran).."%")
  59. guiSetText(serkan12,""..tostring(ddoran).."%")
  60. --guiSetText(serkan13,tostring(hunter))
  61. end
  62. addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),setPlayerPanelIstatistik)
  63. addEvent("setPlayerPanelIstatistik",true)
  64. addEventHandler("setPlayerPanelIstatistik",getRootElement(),setPlayerPanelIstatistik)
  65.  
  66. function showUserPanel (text)
  67.     getVisible = guiGetVisible (window)
  68.     if (getVisible == true) then
  69.         guiSetVisible (window, false)
  70.         showCursor (false)
  71.         guiSetInputEnabled(false)
  72.         triggerServerEvent("setPlayerPanelIstatistik",getLocalPlayer())
  73.     else
  74.         guiSetVisible (window, true)
  75.         showCursor (true)
  76.         guiSetInputEnabled(true)
  77.         triggerServerEvent("setPlayerPanelIstatistik",getLocalPlayer())
  78.     end
  79.     if text ~= false then
  80.         if editChangeWinText then
  81.             guiSetText(editChangeWinText, text)
  82.         end
  83.     else
  84.         if editChangeWinText then
  85.             guiSetText(editChangeWinText, "Win Text TRF clan by ozel oyuncular vyrobil by 8Q (renkkodlari aktiftir)")
  86.         end
  87.     end
  88. end
  89. addEvent("YesYouAreLogedIn", true)
  90. addEventHandler("YesYouAreLogedIn", getRootElement(), showUserPanel )
  91. font8q3 = guiCreateFont( "font.ttf" , 20 )
  92. font8q3x = guiCreateFont( "font.ttf" , 16 )
  93. font8q = guiCreateFont( "font.ttf" , 30 )
  94. font8qx = guiCreateFont( "font.ttf" , 12 )
  95. font8qxjx = guiCreateFont( "font.ttf" , 40 )
  96. font8qxj = guiCreateFont( "font2.ttf" , 40 )  
  97. font8qxjxx = guiCreateFont( "font2.ttf" , 30 )
  98. font8qxjxxs = guiCreateFont( "font2.ttf" , 40 )  
  99. yapim2 = guiCreateFont( "font.ttf" , 10 )
  100. font8qpara = guiCreateFont( "font.ttf" , 13 )
  101.  
  102. butonfont = guiCreateFont( "font3.ttf" , 10 )
  103.  
  104. addEventHandler ( "onClientGUIClick", gRoot, Buttons )
  105. -----------------------------------------------------------------------------
  106.     screenWidth,screenHeight = guiGetScreenSize()
  107.     mainWindowWidth = 619
  108.     mainWindowHeight = 365
  109.     selectedR, selectedG, selectedB = 255, 255, 255
  110.  
  111.     tabs = {}
  112.     window = guiCreateStaticImage( screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight, "files/window.png", false )
  113.     guiWindowSetMovable(window, true)
  114.     guiWindowSetSizable(window, false)
  115.     --tabs[1] = guiCreateTabPanel(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,false,window)
  116.     tabs[1] = guiCreateTabPanel(0,20,mainWindowWidth,mainWindowHeight,false,window)
  117.     tabs[10] = guiCreateTab("Stats",tabs[1])
  118.     tabs[5] = guiCreateTab("Harita",tabs[1])
  119.     --tabs[8] = guiCreateTab("Korna",tabs[1])
  120.     tabs[50] = guiCreateTab("wheels",tabs[1])
  121.     tabs[2] = guiCreateTab("Arac Renk",tabs[1])
  122.  
  123.  
  124.  
  125.  
  126.    
  127. GUIEditor_Button = {}
  128. GUIEditor_Label = {}
  129. serkan = {} 
  130. Gui_Image = {}
  131.  
  132.  
  133. -----------------------------------
  134.  
  135. -- wheels
  136.  
  137. Gui_Image1 = guiCreateStaticImage(155,8,189,162,"images/1.jpg",false,tabs[50])
  138. Gui_Image2 = guiCreateStaticImage(155,8,189,162,"images/2.jpg",false,tabs[50])
  139. Gui_Image3 = guiCreateStaticImage(155,8,189,162,"images/3.jpg",false,tabs[50])
  140. Gui_Image4 = guiCreateStaticImage(155,8,189,162,"images/4.jpg",false,tabs[50])
  141. Gui_Image5 = guiCreateStaticImage(155,8,189,162,"images/5.jpg",false,tabs[50])
  142. Gui_Image6 = guiCreateStaticImage(155,8,189,162,"images/6.jpg",false,tabs[50])
  143. Gui_Image7 = guiCreateStaticImage(155,8,189,162,"images/7.jpg",false,tabs[50])
  144. Gui_Image8 = guiCreateStaticImage(155,8,189,162,"images/8.jpg",false,tabs[50])
  145. Gui_Image9 = guiCreateStaticImage(155,8,189,162,"images/9.jpg",false,tabs[50])
  146. Gui_Image10 = guiCreateStaticImage(155,8,189,162,"images/10.jpg",false,tabs[50])
  147. Gui_Image11 = guiCreateStaticImage(155,8,189,162,"images/11.jpg",false,tabs[50])
  148. Gui_Image12 = guiCreateStaticImage(155,8,189,162,"images/12.jpg",false,tabs[50])
  149. Gui_Image13 = guiCreateStaticImage(155,8,189,162,"images/13.jpg",false,tabs[50])
  150. Gui_Image14 = guiCreateStaticImage(155,8,189,162,"images/14.jpg",false,tabs[50])
  151. Gui_Image15 = guiCreateStaticImage(155,8,189,162,"images/15.jpg",false,tabs[50])
  152. Gui_Image16 = guiCreateStaticImage(155,8,189,162,"images/16.jpg",false,tabs[50])
  153.  
  154.  
  155.  
  156.  
  157. Gui_JantLabel = guiCreateLabel(360,50,1000,1000,"",false,tabs[50])
  158. guiSetFont(Gui_JantLabel,font8qxjx)
  159. guiLabelSetColor(Gui_JantLabel,255,102,0)
  160. guiSetText (Gui_JantLabel, "1 / 16")
  161. Gui_Sol = guiCreateButton(130,180,100,50,"Back",false,tabs[50])
  162. Gui_Sag = guiCreateButton(250,180,100,50,"Next",false,tabs[50])
  163. Gui_Jantbuy = guiCreateButton(180,250,130,27,"Buy",false,tabs[50])
  164.  
  165. guiSetFont(Gui_Sol,butonfont)
  166. guiSetFont(Gui_Sag,butonfont)
  167. guiSetFont(Gui_Jantbuy,butonfont)
  168.  
  169.  
  170. --[[
  171. Gui_JantLabelx = guiCreateLabel(20,50,100,100,"ARK",false,tabs[50])
  172. guiSetFont(Gui_JantLabelx,font8qxj)
  173. guiLabelSetColor(Gui_JantLabelx,255,102,0)
  174.  
  175. --]]
  176.  
  177. GUIEditor_Label[50] = guiCreateLabel(0.54,0.8585,0.5905,0.952,"Prince: $ 31.000",true,tabs[50])
  178. guiLabelSetColor(GUIEditor_Label[50],255,102,0)
  179. guiSetFont(GUIEditor_Label[50],font8q3)
  180. guiLabelSetVerticalAlign(GUIEditor_Label[50],"top")
  181. guiLabelSetHorizontalAlign(GUIEditor_Label[50],"left",false)
  182.  
  183. guiSetVisible(Gui_Image1,true)
  184. guiSetVisible(Gui_Image2,false)
  185. guiSetVisible(Gui_Image3,false)
  186. guiSetVisible(Gui_Image4,false)
  187. guiSetVisible(Gui_Image5,false)
  188. guiSetVisible(Gui_Image6,false)
  189. guiSetVisible(Gui_Image7,false)
  190. guiSetVisible(Gui_Image8,false)
  191. guiSetVisible(Gui_Image9,false)
  192. guiSetVisible(Gui_Image10,false)
  193. guiSetVisible(Gui_Image11,false)
  194. guiSetVisible(Gui_Image12,false)
  195. guiSetVisible(Gui_Image13,false)
  196. guiSetVisible(Gui_Image14,false)
  197. guiSetVisible(Gui_Image15,false)
  198. guiSetVisible(Gui_Image16,false)
  199.  
  200.  
  201.  
  202. -- istatik
  203.    
  204. -- kisim 1
  205.    
  206. GUIEditor_Label[1] = guiCreateLabel(0.0291,0.1185,0.1905,0.052,"Para :",true,tabs[10])
  207. guiLabelSetColor(GUIEditor_Label[1],255,102,0)
  208. guiSetFont(GUIEditor_Label[1],font8qx)
  209. guiLabelSetVerticalAlign(GUIEditor_Label[1],"top")
  210. guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false)
  211.  
  212. GUIEditor_Label[20] = guiCreateLabel(0.0291,0.2185,0.8905,0.052,"DM/Toplam Oyun:",true,tabs[10])
  213. guiLabelSetColor(GUIEditor_Label[20],255,102,0)
  214. guiSetFont(GUIEditor_Label[20],font8qx)
  215. guiLabelSetVerticalAlign(GUIEditor_Label[20],"top")
  216. guiLabelSetHorizontalAlign(GUIEditor_Label[20],"left",false)
  217.  
  218. GUIEditor_Label[3] = guiCreateLabel(0.0291,0.3185,0.1905,0.052,"DM/Kazanma:",true,tabs[10])
  219. guiLabelSetColor(GUIEditor_Label[3],255,102,0)
  220. guiSetFont(GUIEditor_Label[3],font8qx)
  221. guiLabelSetVerticalAlign(GUIEditor_Label[3],"top")
  222. guiLabelSetHorizontalAlign(GUIEditor_Label[3],"left",false)
  223.  
  224. GUIEditor_Label[4] = guiCreateLabel(0.0291,0.4185,0.1905,0.052,"Point:",true,tabs[10])
  225. guiLabelSetColor(GUIEditor_Label[4],255,102,0)
  226. guiSetFont(GUIEditor_Label[4],font8qx)
  227. guiLabelSetVerticalAlign(GUIEditor_Label[4],"top")
  228. guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false)
  229.  
  230. GUIEditor_Label[5] = guiCreateLabel(0.0291,0.5185,0.1905,0.052,"Rank:",true,tabs[10])
  231. guiLabelSetColor(GUIEditor_Label[5],255,102,0)
  232. guiSetFont(GUIEditor_Label[5],font8qx)
  233. guiLabelSetVerticalAlign(GUIEditor_Label[5],"top")
  234. guiLabelSetHorizontalAlign(GUIEditor_Label[5],"left",false)
  235.  
  236. GUIEditor_Label[6] = guiCreateLabel(0.0291,0.6185,0.1905,0.052,"Level:",true,tabs[10])
  237. guiLabelSetColor(GUIEditor_Label[6],255,102,0)
  238. guiSetFont(GUIEditor_Label[6],font8qx)
  239. guiLabelSetVerticalAlign(GUIEditor_Label[6],"top")
  240. guiLabelSetHorizontalAlign(GUIEditor_Label[6],"left",false)
  241.  
  242. GUIEditor_Label[7] = guiCreateLabel(0.0291,0.7185,0.8905,0.052,"DD/Toplam Oyun:",true,tabs[10])
  243. guiLabelSetColor(GUIEditor_Label[7],255,102,0)
  244. guiSetFont(GUIEditor_Label[7],font8qx)
  245. guiLabelSetVerticalAlign(GUIEditor_Label[7],"top")
  246. guiLabelSetHorizontalAlign(GUIEditor_Label[7],"left",false)
  247.  
  248. GUIEditor_Label[8] = guiCreateLabel(0.0291,0.8185,0.8905,0.052,"DD/Kazanma:",true,tabs[10])
  249. guiLabelSetColor(GUIEditor_Label[8],255,102,0)
  250. guiSetFont(GUIEditor_Label[8],font8qx)
  251. guiLabelSetVerticalAlign(GUIEditor_Label[8],"top")
  252. guiLabelSetHorizontalAlign(GUIEditor_Label[8],"left",false)
  253.  
  254. -------------------------------------------------------------------------------------
  255.  
  256. -- kasim 2
  257. GUIEditor_Label[9] = guiCreateLabel(0.5,0.1185,0.1905,0.052,"Oyun zamani:",true,tabs[10])
  258. guiLabelSetColor(GUIEditor_Label[9],255,102,0)
  259. guiSetFont(GUIEditor_Label[9],font8qx)
  260. guiLabelSetVerticalAlign(GUIEditor_Label[9],"top")
  261. guiLabelSetHorizontalAlign(GUIEditor_Label[9],"left",false)
  262.  
  263. GUIEditor_Label[10] = guiCreateLabel(0.5,0.2185,0.1905,0.052,"Son cikis:",true,tabs[10])
  264. guiLabelSetColor(GUIEditor_Label[10],255,102,0)
  265. guiSetFont(GUIEditor_Label[10],font8qx)
  266. guiLabelSetVerticalAlign(GUIEditor_Label[10],"top")
  267. guiLabelSetHorizontalAlign(GUIEditor_Label[10],"left",false)
  268.  
  269. GUIEditor_Label[11] = guiCreateLabel(0.5,0.3185,0.1905,0.052,"DM Oran:",true,tabs[10])
  270. guiLabelSetColor(GUIEditor_Label[11],255,102,0)
  271. guiSetFont(GUIEditor_Label[11],font8qx)
  272. guiLabelSetVerticalAlign(GUIEditor_Label[11],"top")
  273. guiLabelSetHorizontalAlign(GUIEditor_Label[11],"left",false)
  274.  
  275. GUIEditor_Label[12] = guiCreateLabel(0.5,0.4185,0.1905,0.052,"DD Oran:",true,tabs[10])
  276. guiLabelSetColor(GUIEditor_Label[12],255,102,0)
  277. guiSetFont(GUIEditor_Label[12],font8qx)
  278. guiLabelSetVerticalAlign(GUIEditor_Label[12],"top")
  279. guiLabelSetHorizontalAlign(GUIEditor_Label[12],"left",false)
  280.  
  281.  
  282. GUIEditor_Label[13] = guiCreateLabel(0.5,0.7185,0.5905,0.952,"",true,tabs[10])
  283. guiLabelSetColor(GUIEditor_Label[13],255,0,0)
  284. guiSetFont(GUIEditor_Label[13],font8q3)
  285. guiLabelSetVerticalAlign(GUIEditor_Label[13],"top")
  286. guiLabelSetHorizontalAlign(GUIEditor_Label[13],"left",false)
  287. --[[
  288.  GUIEditor_Label[13] = guiCreateLabel(0.5,0.5185,0.1905,0.052,"Hunter:",true,tabs[10])
  289. guiLabelSetColor(GUIEditor_Label[13],255,102,0)
  290. guiSetFont(GUIEditor_Label[13],font8qx)
  291. guiLabelSetVerticalAlign(GUIEditor_Label[13],"top")
  292. guiLabelSetHorizontalAlign(GUIEditor_Label[13],"left",false)  --]]
  293.  
  294.  
  295. --kasim 1 (2)
  296.  
  297. serkan1 = guiCreateLabel(0.08,0.1185,0.4841,0.0578,"$0",true,tabs[10])
  298. guiLabelSetColor(serkan1,255 , 255, 255)
  299. guiSetFont(serkan1,font8qx)
  300. guiLabelSetVerticalAlign(serkan1,"top")
  301. guiLabelSetHorizontalAlign(serkan1,"center",false)
  302.  
  303. serkanzx = guiCreateLabel(0.08,0.2185,0.4841,0.0578,"0",true,tabs[10])
  304. guiLabelSetColor(serkanzx,255 , 255, 255)
  305. guiSetFont(serkanzx,font8qx)
  306. guiLabelSetVerticalAlign(serkanzx,"top")
  307. guiLabelSetHorizontalAlign(serkanzx,"center",false) 
  308.  
  309.  
  310.  
  311. serkan3 = guiCreateLabel(0.08,0.3185,0.4841,0.0578,"0",true,tabs[10])
  312. guiLabelSetColor(serkan3,255 , 255, 255)
  313. guiSetFont(serkan3,font8qx)
  314. guiLabelSetVerticalAlign(serkan3,"top")
  315. guiLabelSetHorizontalAlign(serkan3,"center",false)
  316.  
  317. serkan4 = guiCreateLabel(0.08,0.4185,0.4841,0.0578,"0",true,tabs[10])
  318. guiLabelSetColor(serkan4,255 , 255, 255)
  319. guiSetFont(serkan4,font8qx)
  320. guiLabelSetVerticalAlign(serkan4,"top")
  321. guiLabelSetHorizontalAlign(serkan4,"center",false)
  322.  
  323. serkan5 = guiCreateLabel(0.08,0.5185,0.4841,0.0578,"0",true,tabs[10])
  324. guiLabelSetColor(serkan5,255 , 255, 255)
  325. guiSetFont(serkan5,font8qx)
  326. guiLabelSetVerticalAlign(serkan5,"top")
  327. guiLabelSetHorizontalAlign(serkan5,"center",false)
  328.  
  329. serkan6 = guiCreateLabel(0.08,0.6185,0.4841,0.0578,"N/A",true,tabs[10])
  330. guiLabelSetColor(serkan6,255 , 255, 255)
  331. guiSetFont(serkan6,font8qx)
  332. guiLabelSetVerticalAlign(serkan6,"top")
  333. guiLabelSetHorizontalAlign(serkan6,"center",false)
  334.  
  335. serkan7 = guiCreateLabel(0.08,0.7185,0.4841,0.0578,"0",true,tabs[10])
  336. guiLabelSetColor(serkan7,255 , 255, 255)
  337. guiSetFont(serkan7,font8qx)
  338. guiLabelSetVerticalAlign(serkan7,"top")
  339. guiLabelSetHorizontalAlign(serkan7,"center",false)
  340.  
  341. serkan8 = guiCreateLabel(0.08,0.8185,0.4841,0.0578,"0",true,tabs[10])
  342. guiLabelSetColor(serkan8,255 , 255, 255)
  343. guiSetFont(serkan8,font8qx)
  344. guiLabelSetVerticalAlign(serkan8,"top")
  345. guiLabelSetHorizontalAlign(serkan8,"center",false)
  346. ---------------------------------------------------------------------------------
  347.  
  348. -- kisim (2)
  349.  
  350. serkan9 = guiCreateLabel(0.58,0.1185,0.4841,0.0578,"0",true,tabs[10])
  351. guiLabelSetColor(serkan9,255 , 255, 255)
  352. guiSetFont(serkan9,font8qx)
  353. guiLabelSetVerticalAlign(serkan9,"top")
  354. guiLabelSetHorizontalAlign(serkan9,"center",false) 
  355.  
  356. serkan10 = guiCreateLabel(0.58,0.2185,0.4841,0.0578,"0",true,tabs[10])
  357. guiLabelSetColor(serkan10,255 , 255, 255)
  358. guiSetFont(serkan10,font8qx)
  359. guiLabelSetVerticalAlign(serkan10,"top")
  360. guiLabelSetHorizontalAlign(serkan10,"center",false) 
  361.  
  362. serkan11 = guiCreateLabel(0.58,0.3185,0.4841,0.0578,"0",true,tabs[10])
  363. guiLabelSetColor(serkan11,255 , 255, 255)
  364. guiSetFont(serkan11,font8qx)
  365. guiLabelSetVerticalAlign(serkan11,"top")
  366. guiLabelSetHorizontalAlign(serkan11,"center",false)
  367.  
  368. serkan12 = guiCreateLabel(0.58,0.4185,0.4841,0.0578,"0",true,tabs[10])
  369. guiLabelSetColor(serkan12,255 , 255, 255)
  370. guiSetFont(serkan12,font8qx)
  371. guiLabelSetVerticalAlign(serkan12,"top")
  372. guiLabelSetHorizontalAlign(serkan12,"center",false) 
  373. --[[
  374. serkan13 = guiCreateLabel(0.58,0.4185,0.4841,0.0578,"0",true,tabs[10])
  375. guiLabelSetColor(serkan13,255 , 255, 255)
  376. guiSetFont(serkan13,font8qx)
  377. guiLabelSetVerticalAlign(serkan13,"top")
  378. guiLabelSetHorizontalAlign(serkan13,"center",false) 
  379. --]]   
  380.  
  381. ------------------------------------------------------------------------------
  382.  
  383. --[[
  384. -- trubky
  385.  
  386. -- Create horns
  387. hornName={
  388. "Default GTA horn",
  389. "Airhorn",
  390. "Clown",
  391. "Train",
  392. "Fog horn",
  393. "Submarine",
  394. "Military trumpet",
  395. "Mr. Whoopie",
  396. "Meep Meep",
  397. "Tra-la-la",
  398. "Yehaw",
  399. "Train #2",
  400. "Magoo",
  401. "Ahooga",
  402. "Cluck",
  403. "Carhorn",
  404. "Shipshorn"}
  405.  
  406. hornPrice={
  407.  "N/A",
  408.   2000,
  409.   4000,
  410.   6000,
  411.   8000,
  412.   10000,
  413.   12000,
  414.   14000,
  415.   16000,
  416.   18000,
  417.   20000,
  418.   22000,
  419.   24000,
  420.   26000,
  421.   28000,
  422.   30000,
  423.   31310
  424. }
  425.  
  426. hornSound={
  427. "sounds/airhorn.wav",
  428. "sounds/clownhorn.mp3",
  429. "sounds/trainhorn.mp3",
  430. "sounds/cargoshiphorn.mp3",
  431. "sounds/submarinehorn.wav",
  432. "sounds/generalleehorn.mp3",
  433. "sounds/whoopiehorn.mp3",
  434. "sounds/meepmeep.mp3",
  435. "sounds/tralalala.mp3",
  436. "sounds/yehaw.mp3",
  437. "sounds/roadtrain.mp3",
  438. "sounds/magoo.mp3",
  439. "sounds/ahooga.mp3",
  440. "sounds/cluck.mp3",
  441. "sounds/carhorn.mp3",
  442. "sounds/shipshorn.mp3"}
  443.  
  444.  
  445.  
  446.  
  447.  
  448.     -- horn interface
  449.     gridHorns = guiCreateGridList(24,56,191,260,false,tabs[8])
  450.     guiGridListAddColumn(gridHorns,"Horn",0.6)
  451.     guiGridListAddColumn(gridHorns,"Price",0.3)
  452.     guiGridListSetSortingEnabled(gridHorns,false)
  453.  
  454. for _,horn in ipairs(hornName) do
  455.         local row = guiGridListAddRow(gridHorns)
  456.         guiGridListSetItemText(gridHorns,row,1,horn,false,false)
  457.         guiGridListSetItemColor(gridHorns,row,1,180,180,180,255)
  458.     end
  459.  
  460. for _,price in ipairs(hornPrice) do
  461.         guiGridListSetItemText(gridHorns,_-1,2,price,false,false)
  462.         guiGridListSetItemColor(gridHorns,_-1,2,180,180,180,255)
  463.     end
  464.  
  465.  
  466.     lblCustomHornInfo = guiCreateLabel(30,10,170,50,"Horns",false,tabs[8])
  467.     guiLabelSetColor(lblCustomHornInfo,255,120,0)
  468.     guiSetFont(lblCustomHornInfo,font8qxjxx)
  469.  
  470.     btnSetHornSound = guiCreateButton(220,250,120,40,"selects Use",false,tabs[8])
  471.     guiSetEnabled(btnSetHornSound,false)
  472.    
  473.     guiSetFont(btnSetHornSound,butonfont)
  474.     --xssbtnPreviewHornxx = guiCreateStaticImage(225,80,83,26,"files/window.png",false,tabs[8])
  475.  
  476.     btnPreviewHorn = guiCreateButton(225,80,95,30,"Try honk",false,tabs[8])
  477.    
  478.     guiSetEnabled(btnPreviewHorn,false)
  479.    
  480.     guiSetFont(btnPreviewHorn,butonfont)
  481.  
  482.     btnBuyHorn = guiCreateButton(225,167,95,30,"Buy-in",false,tabs[8])
  483.    
  484.     guiSetEnabled(btnBuyHorn,false)
  485.  
  486.     guiSetFont(btnBuyHorn,butonfont)
  487.    
  488.     lblHornPriceNot = guiCreateLabel(225,127,83,15,"price",false,tabs[8])
  489.     guiLabelSetColor(lblHornPriceNot,255,120,0)
  490.     guiLabelSetHorizontalAlign(lblHornPriceNot,"center",false)
  491.     guiSetFont(lblHornPriceNot,font8qx)
  492.  
  493.     lblHornPrice = guiCreateLabel(225,142,83,15,"N/A",false,tabs[8])
  494.     guiLabelSetVerticalAlign(lblHornPrice,"center")
  495.     guiLabelSetHorizontalAlign(lblHornPrice,"center",false)
  496.     guiSetFont(lblHornPrice,font8qx)
  497.  
  498.     lblCurrentHorn = guiCreateLabel(370,220,200,100,"",false,tabs[8])
  499.     guiSetFont(lblCurrentHorn,font8q3x)
  500.    
  501.     lblCurrentHornxz = guiCreateLabel(365,170,170,100,"Horns",false,tabs[8])
  502.     guiSetFont(lblCurrentHornxz,font8qxjxxs)
  503.     guiLabelSetColor(lblCurrentHornxz,255,120,0)
  504.  
  505.     kornaimg = guiCreateStaticImage(0.55,0.08,0.4,0.4,"files/korna.png",true,tabs[8])
  506.    
  507.    
  508.  
  509.  
  510.  
  511.     lblCustomHornInfox = guiCreateLabel(500,700,143,16,"Custom horn sounds",false,tabs[8])
  512.     guiLabelSetColor(lblCustomHornInfox,255,120,0)
  513.     guiSetFont(lblCustomHornInfox,font8q)
  514.  
  515.  
  516. --]]
  517.    
  518.    
  519.    
  520.  
  521.     -------------------------------------------------------------
  522.     lblBuyColor = guiCreateLabel(25,25,560,15,"Change color by your vehicle.",false,tabs[2])
  523.     guiLabelSetHorizontalAlign(lblBuyColor, "center")
  524.     --guiLabelSetVerticalAlign(lblBuyColor, "center")
  525.     guiSetFont(lblBuyColor,font8qx)
  526.     btnMixColor = guiCreateButton(25,50,170,35,"Renk 1 Sec",false,tabs[2])
  527.    
  528.         guiSetFont(btnMixColor,butonfont)
  529.     btnMixColor2 = guiCreateButton(25,90,170,35,"Renk 2 Sec",false,tabs[2])
  530.    
  531.     guiSetFont(btnMixColor2,butonfont)
  532.     btnBuyColor = guiCreateButton(215,50,170,75,"color Buy\n$ 25.000",false,tabs[2])
  533.     guiSetFont(btnBuyColor,butonfont)
  534.     btnRmvColor = guiCreateButton(405,50,170,75,"color Remove\nBedava!",false,tabs[2])
  535.     guiSetFont(btnRmvColor,butonfont)
  536.     asfg = guiCreateLabel(25,130,560,15,"______________________________________________________________________________",false,tabs[2])
  537.     guiLabelSetHorizontalAlign(asfg, "center")
  538.     btnDisco = guiCreateButton(215,170,170,150,"Disco Far Al\n$ 100.000",false,tabs[2])
  539.     guiSetFont(btnDisco,butonfont)
  540.     btnBuyLight = guiCreateButton(25,170,170,70,"Normal Far\n$ 15.000",false,tabs[2])
  541.     guiSetFont(btnBuyLight,butonfont)
  542.     btnBChangeLight = guiCreateButton(25,250,170,70,"Shadow Color exchange",false,tabs[2])
  543.     guiSetFont(btnBChangeLight,butonfont)
  544.     btnDisco2 = guiCreateButton(405,170,170,150,"Remove all\nBedava!",false,tabs[2])
  545.     guiSetFont(btnDisco2,butonfont)
  546.     -------------------------------------------------------------
  547.  
  548.  
  549.  
  550.  
  551.     btnClose = guiCreateButton(575,10,20,20,"X",false,tabs[5])
  552.     guiSetFont(btnClose,butonfont)
  553.     btnClose2 = guiCreateButton(575,10,20,20,"X",false,tabs[2])
  554.     guiSetFont(btnClose2,butonfont)
  555.     guiSetVisible(window,false)
  556.    
  557.         btnClose3 = guiCreateButton(575,10,20,20,"X",false,tabs[10])
  558.     guiSetFont(btnClose3,butonfont)
  559.    
  560.  
  561.                 btnClose5 = guiCreateButton(575,10,20,20,"X",false,tabs[50])
  562.     guiSetFont(btnClose5,butonfont)
  563.    
  564.                 --  btnClose6 = guiCreateButton(575,10,20,20,"X",false,tabs[8])
  565.     --guiSetFont(btnClose6,butonfont)
  566.    
  567.     guiSetFont(btnClose7,butonfont)
  568.    
  569.     gridMaps = guiCreateGridList(20,20,400,250,false,tabs[5])
  570.     guiGridListSetSortingEnabled(gridMaps,false)
  571.     guiGridListAddColumn(gridMaps,"Map name",0.9)
  572.  
  573.     lblMapsInfo = guiCreateLabel(342,210,245,45,"",false,tabs[5])
  574.     guiLabelSetVerticalAlign(lblMapsInfo,"center")
  575.     guiLabelSetHorizontalAlign(lblMapsInfo,"center",true)
  576.     guiSetFont(lblMapsInfo,font8qx)
  577.    
  578.  
  579.  
  580.  
  581.     lblSearchForMaps = guiCreateLabel(25,280,101,14,"Search",false,tabs[5])
  582.     guiLabelSetColor(lblSearchForMaps,255,120,0)
  583.     guiLabelSetVerticalAlign(lblSearchForMaps,"center")
  584.     guiSetFont(lblSearchForMaps,font8qx)
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.     editMapSearch = guiCreateEdit(132,280,210,30,"",false,tabs[5])
  594.  
  595.     btnBuyNextMap = guiCreateButton(433,136,169,44,"Buy Map \n $5000",false,tabs[5])
  596.    
  597.         guiSetFont(btnBuyNextMap,butonfont)
  598.        
  599. function cursorInfo()
  600.    local showing = isCursorShowing ()
  601.    if showing then -- if the cursor is showing
  602.       local screenx, screeny, worldx, worldy, worldz = getCursorPosition()
  603.  
  604.       outputChatBox( string.format( "Cursor screen position (relative): X=%.4f Y=%.4f", screenx, screeny ) ) -- make the accuracy of floats 4 decimals
  605.       outputChatBox( string.format( "Cursor world position: X=%.4f Y=%.4f Z=%.4f", worldx, worldy, worldz ) ) -- make the accuracy of floats 4 decimals accurate
  606.    else
  607.       outputChatBox( "Your cursor is not showing." )
  608.    end
  609. end
  610. addCommandHandler( "pos", cursorInfo ) 
  611.  
  612. isTabPremCreated = false
  613. function checkIfPlayerIsPrem (isPrem)
  614.     if isPrem == true then
  615.         if isTabPremCreated == false then
  616.             PremTab = guiCreateTab("MTA-TRF",tabs[1])
  617.             btnClose3 = guiCreateButton(575,10,20,20,"X",false,PremTab)
  618.             btnChangeChatColor = guiCreateButton(10,10,555,50,"Chat Renk Bakımda..",false,PremTab)
  619.             addEventHandler ( "onClientGUIClick", btnClose3, btnCloseWIndowsss3, false )
  620.             addEventHandler ( "onClientGUIClick", btnChangeChatColor, changechatColor_func, false )
  621.             guiCreateLabel(10,62,580,15,"__________________________________________________________________________________",false,PremTab)
  622.             editChangeWinText = guiCreateEdit(10,90,580,21,"Win Text TRF clan by ozel oyuncular vyrobil by 8Q (renkkodlari aktiftir)",false,PremTab)
  623.             btnChangeWinText = guiCreateButton(10,121,580,50,"Change Win-Text",false,PremTab)
  624.             addEventHandler ( "onClientGUIClick", btnChangeWinText, changeWinText_func, false )
  625.             thxSagung = guiCreateLabel(10,181,580,150,"MTA-TRF  8Q",false,PremTab)
  626.             guiLabelSetColor(thxSagung, 255, 102, 0)
  627.             guiLabelSetHorizontalAlign(thxSagung, "center")
  628.             guiLabelSetVerticalAlign(thxSagung, "center")
  629.             guiSetFont(thxSagung,"sa-header")
  630.             isTabPremCreated = true
  631.         end
  632.     elseif isPrem == false then
  633.         if isTabPremCreated == true then
  634.             guiDeleteTab(PremTab,tabs[1])
  635.             removeEventHandler ( "onClientGUIClick", btnClose3, btnCloseWIndowsss3, false )
  636.             removeEventHandler ( "onClientGUIClick", btnChangeChatColor, changechatColor_func, false )
  637.             removeEventHandler ( "onClientGUIClick", btnChangeWinText, changeWinText_func, false )
  638.             isTabPremCreated = false
  639.         end
  640.     end
  641. end
  642. addEvent("playerIsPremium", true)
  643. addEventHandler("playerIsPremium", getRootElement(), checkIfPlayerIsPrem )
  644.  
  645.  
  646.  
  647.  
  648. function giveMoney(source)
  649. outputChatBox("What is Under Construction basıyon amk diyoz!",source,255,0,0,true)
  650. end
  651.  
  652.  
  653.  
  654.  
  655.    
  656.  
  657. function changechatColor_func()
  658.     exports.cpicker:openPicker("cPicChatColor", "#FFFFFF", "Select your Chatcolor")
  659.     showCursor(false)
  660.     guiSetVisible (window, false)
  661. end
  662.  
  663. function changeWinText_func()
  664.     wintext = guiGetText(editChangeWinText)
  665.     if wintext ~= "" then
  666.         triggerServerEvent("buyWinText", getLocalPlayer(), wintext)
  667.     else
  668.         outputChatBox("Please enter a text.", 255, 0, 0)
  669.     end
  670. end
  671.  
  672. showHunterReached = false
  673. function playerHunterAlarmSound()
  674.     showHunterReached = true
  675.     playSound("files/hunter.mp3", false)
  676.     timerTime = 850
  677.     setTimer(function()
  678.             showHunterReached = false
  679.             setTimer(function()
  680.             showHunterReached = true
  681.                 setTimer(function()
  682.             showHunterReached = false
  683.                 setTimer(function()
  684.             showHunterReached = true
  685.                 setTimer(function()
  686.             showHunterReached = false
  687.                 setTimer(function()
  688.             showHunterReached = true
  689.                 setTimer(function()
  690.             showHunterReached = false
  691.                 setTimer(function()
  692.             showHunterReached = true
  693.                 setTimer(function()
  694.             showHunterReached = false
  695.                
  696.             end, timerTime, 1)
  697.             end, timerTime, 1)
  698.             end, timerTime, 1)
  699.             end, timerTime, 1)
  700.             end, timerTime, 1)
  701.             end, timerTime, 1)
  702.             end, timerTime, 1)
  703.             end, timerTime, 1)
  704.             end, timerTime, 1)
  705. end
  706. addEvent("playerHunterAlarmSound", true)
  707. addEventHandler("playerHunterAlarmSound", getRootElement(), playerHunterAlarmSound )
  708.  
  709. winnerText = " "
  710. winnerText2 = " "
  711. timeTimer = 6000
  712. showWinnerText = false
  713. function showDDWinnerAndHisText (text)
  714.     winnerText = text
  715.     winnerText2 = winnerText:gsub("#%x%x%x%x%x%x","")
  716.     showWinnerText = true
  717.     setTimer(function()
  718.             winnerText = " "
  719.             winnerText2 = " "
  720.             showWinnerText = false
  721.             end, timeTimer, 1)
  722. end
  723. addEvent("showDDWinnerAndHisText", true)
  724. addEventHandler("showDDWinnerAndHisText", getRootElement(), showDDWinnerAndHisText )
  725.  
  726. font = guiCreateFont("font.ttf", 1)
  727.  
  728. screenWidth, screenHeight = guiGetScreenSize ( )
  729. function drawHunterReached()
  730.     if showHunterReached then
  731.      local hud1 = dxDrawText("Hunter reached", 0+2, 0+2, screenWidth+2, screenHeight+2, tocolor ( 0, 0, 0, 255 ), 2, "bankgothic","center","center")
  732.      local hud1 = dxDrawText("Hunter reached", 0, 0, screenWidth, screenHeight, tocolor (math.random(255),math.random(255),math.random(255),255), 2, "bankgothic","center","center")
  733.     elseif showWinnerText then
  734.         dxDrawText(winnerText2, 0+2, 0+2, screenWidth+2, screenHeight/3+2, tocolor ( 0, 0, 0, 255 ), 1.3, "bankgothic","center","center")
  735.         dxDrawColorText(winnerText, 0, 0, screenWidth, screenHeight/3, tocolor ( 255, 0, 0, 255 ), 1.3, "bankgothic","center","center")
  736.     end
  737. end
  738. addEventHandler("onClientRender", getRootElement(), drawHunterReached)
  739.  
  740.  
  741. setTimer(   function()
  742.                         hud1:setColor(tocolor(math.random(255),math.random(255),math.random(255),255))
  743.                     end,2000,0)
  744.  
  745. function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY)
  746.   if alignX then
  747.     if alignX == "center" then
  748.       local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font)
  749.       ax = ax + (bx-ax)/2 - w/2
  750.     elseif alignX == "right" then
  751.       local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font)
  752.       ax = bx - w
  753.     end
  754.   end
  755.  
  756.   if alignY then
  757.     if alignY == "center" then
  758.       local h = dxGetFontHeight(scale, font)
  759.       ay = ay + (by-ay)/2 - h/2
  760.     elseif alignY == "bottom" then
  761.       local h = dxGetFontHeight(scale, font)
  762.       ay = by - h
  763.     end
  764.   end
  765.  
  766.   local pat = "(.-)#(%x%x%x%x%x%x)"
  767.   local s, e, cap, col = str:find(pat, 1)
  768.   local last = 1
  769.   while s do
  770.     if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end
  771.     if s ~= 1 or cap ~= "" then
  772.       local w = dxGetTextWidth(cap, scale, font)
  773.       dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
  774.       ax = ax + w
  775.       color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255)
  776.     end
  777.     last = e + 1
  778.     s, e, cap, col = str:find(pat, last)
  779.   end
  780.   if last <= #str then
  781.     cap = str:sub(last)
  782.     local w = dxGetTextWidth(cap, scale, font)
  783.     dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
  784.   end
  785. end
  786.  
  787.  
  788.     -- Get all maps on server
  789. function getMaps()
  790.     totalServerMaps = 0
  791.     totalDmMaps = 0
  792.     totalDdMaps = 0
  793.     setTimer(callServerfunction,500,1,"getServerMaps",getLocalPlayer())
  794.  
  795. end
  796. addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getMaps)
  797.  
  798. function btnCloseWIndowsss(ele)
  799.     guiSetVisible (window, false)
  800.     showCursor (false)
  801.     guiSetInputEnabled(false)
  802. end
  803. addEventHandler ( "onClientGUIClick", btnClose, btnCloseWIndowsss, false )
  804.  
  805. function btnCloseWIndowsss2(ele)
  806.     guiSetVisible (window, false)
  807.     showCursor (false)
  808.     guiSetInputEnabled(false)
  809. end
  810. addEventHandler ( "onClientGUIClick", btnClose2, btnCloseWIndowsss2, false )
  811.  
  812. function btnCloseWIndowsss3(ele)
  813.     guiSetVisible (window, false)
  814.     showCursor (false)
  815.     guiSetInputEnabled(false)
  816. end
  817. addEventHandler ( "onClientGUIClick", btnClose3, btnCloseWIndowsss3, false )
  818.  
  819. function btnCloseWIndowsss4(ele)
  820.     guiSetVisible (window, false)
  821.     showCursor (false)
  822.     guiSetInputEnabled(false)
  823. end
  824. addEventHandler ( "onClientGUIClick", btnClose4, btnCloseWIndowsss4, false )
  825.  
  826. function btnCloseWIndowsss5(ele)
  827.     guiSetVisible (window, false)
  828.     showCursor (false)
  829.     guiSetInputEnabled(false)
  830. end
  831. addEventHandler ( "onClientGUIClick", btnClose5, btnCloseWIndowsss5, false )
  832.  
  833. function btnCloseWIndowsss6(ele)
  834.     guiSetVisible (window, false)
  835.     showCursor (false)
  836.     guiSetInputEnabled(false)
  837. end
  838. addEventHandler ( "onClientGUIClick", btnClose6, btnCloseWIndowsss6, false )
  839.  
  840. function btnCloseWIndowsss7(ele)
  841.     guiSetVisible (window, false)
  842.     showCursor (false)
  843.     guiSetInputEnabled(false)
  844. end
  845. addEventHandler ( "onClientGUIClick", btnClose7, btnCloseWIndowsss7, false )
  846. function btnCloseWIndowsss3(ele)
  847.     guiSetVisible (window, false)
  848.     showCursor (false)
  849.     guiSetInputEnabled(false)
  850. end
  851.  
  852. function removeCC(ele)
  853.     triggerServerEvent("removeCarColor", getLocalPlayer())
  854. end
  855. addEventHandler ( "onClientGUIClick", btnRmvColor, removeCC, false )
  856.  
  857. function buyDL(ele)
  858.     triggerServerEvent("buyDiscoLights", getLocalPlayer())
  859. end
  860. addEventHandler ( "onClientGUIClick", btnDisco, buyDL, false )
  861.  
  862. function removeDL(ele)
  863.     triggerServerEvent("removeDiscoLights", getLocalPlayer())
  864. end
  865. addEventHandler ( "onClientGUIClick", btnDisco2, removeDL, false )
  866.  
  867.  
  868.  
  869. function buyNL(ele)
  870.     triggerServerEvent("buyNormalLights", getLocalPlayer())
  871. end
  872. addEventHandler ( "onClientGUIClick", btnBuyLight, buyNL, false )
  873.  
  874. function changeNormalLight(ele)
  875.     exports.cpicker:openPicker("cPicNormalLightColor", "#FFFFFF", "Select your light color")
  876.     showCursor(false)
  877.     guiSetVisible (window, false)
  878. end
  879. addEventHandler ( "onClientGUIClick", btnBChangeLight, changeNormalLight, false )
  880.  
  881. function shopPickups(ele)
  882.     exports.cpicker:openPicker("cPicCarColor", "#FFFFFF", "The selected color")
  883.     showCursor(false)
  884.     guiSetVisible (window, false)
  885. end
  886. addEventHandler ( "onClientGUIClick", btnMixColor, shopPickups, false )
  887.  
  888. function shopPickups2(ele)
  889.     exports.cpicker:openPicker("cPicCarColor2", "#FFFFFF", "The selected color")
  890.     showCursor(false)
  891.     guiSetVisible (window, false)
  892. end
  893. addEventHandler ( "onClientGUIClick", btnMixColor2, shopPickups2, false )
  894.  
  895. function buyColor(ele)
  896.     triggerServerEvent("buyCarColor", getLocalPlayer())
  897. end
  898. addEventHandler ( "onClientGUIClick", btnBuyColor, buyColor, false )
  899.  
  900. function aktualisiereCPicer(element, hex, r, g, b)
  901.     if element == "cPicCarColor" then
  902.         guiLabelSetColor(lblBuyColor, r, g, b)
  903.         selectedR, selectedG, selectedB = r, g, b
  904.         guiSetVisible (window, true)
  905.         triggerServerEvent("saveCarColor", getLocalPlayer(), selectedR, selectedG, selectedB)
  906.         showCursor(true)
  907.     elseif element == "cPicCarColor2" then
  908.         guiLabelSetColor(lblBuyColor, r, g, b)
  909.         selectedR, selectedG, selectedB = r, g, b
  910.         guiSetVisible (window, true)
  911.         triggerServerEvent("saveCarColor2", getLocalPlayer(), selectedR, selectedG, selectedB)
  912.         showCursor(true)
  913.     elseif element == "cPicNormalLightColor" then
  914.         selectedR, selectedG, selectedB = r, g, b
  915.         guiSetVisible (window, true)
  916.         triggerServerEvent("saveLightColor", getLocalPlayer(), selectedR, selectedG, selectedB)
  917.         showCursor(true)
  918.     elseif element == "cPicChatColor" then
  919.         guiSetVisible (window, true)
  920.         triggerServerEvent("saveChatColor", getLocalPlayer(), hex)
  921.         showCursor(true)
  922.     end
  923. end
  924. addEventHandler ("onColorPickerOK", getRootElement(), aktualisiereCPicer)
  925.  
  926. function loadMaps(gamemodeMapTable, gamemode, map)
  927.     guiGridListClear(gridMaps)
  928.     if gamemodeMapTable then
  929.         aGamemodeMapTable = gamemodeMapTable
  930.         for id,gamemode in pairs (gamemodeMapTable) do
  931.             if (gamemode.name == "Race") then
  932.                 for id,map in ipairs (gamemode.maps) do
  933.                     local row = guiGridListAddRow ( gridMaps )
  934.                     guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false )
  935.                     guiGridListSetItemData ( gridMaps, row, 1, map.resname)
  936.                     totalServerMaps = totalServerMaps+1
  937.                     if (string.find(map.name,"[DM]",1,true)) then
  938.                         totalDmMaps = totalDmMaps+1
  939.                     elseif (string.find(map.name,"[DD]",1,true)) then
  940.                         totalDdMaps = totalDdMaps+1
  941.                     end
  942.                     updateMapLabels(1)
  943.                 end
  944.             end
  945.         end
  946.     end
  947. end
  948.  
  949.  
  950. -- Map search
  951. function mapSearch()
  952.     guiGridListClear(gridMaps)
  953.     local searchString = string.lower(guiGetText(editMapSearch))
  954.     if ( searchString == "" ) then
  955.         for id,gamemode in pairs (aGamemodeMapTable) do
  956.             if (gamemode.name == "Race") then
  957.                 for id,map in ipairs (gamemode.maps) do
  958.                     local row = guiGridListAddRow ( gridMaps )
  959.                     guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false )
  960.                     guiGridListSetItemData ( gridMaps, row, 1, map.resname)
  961.                 end
  962.             end
  963.         end
  964.     else
  965.         for id,gamemode in pairs (aGamemodeMapTable) do
  966.             if (gamemode.name == "Race") then
  967.                 local noMapsFound = true
  968.                 for id,map in ipairs (gamemode.maps) do
  969.                     if string.find(string.lower(map.name.." "..map.resname), searchString, 1, true) then
  970.                         local row = guiGridListAddRow ( gridMaps )
  971.                         guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false )
  972.                         guiGridListSetItemData ( gridMaps, row, 1, map.resname)
  973.                         noMapsFound = false
  974.                     end
  975.                 end
  976.                 if noMapsFound == true then
  977.                     local row = guiGridListAddRow(gridMaps)
  978.                     guiGridListSetItemText (gridMaps, row, 1, "No maps matching your search query!", false, false)
  979.                     guiGridListSetItemColor (gridMaps, row, 1, 255,50,50)
  980.                 end
  981.             end
  982.         end
  983.     end
  984.     updateMapLabels(2)
  985. end
  986.  
  987. function buyNextMap()
  988.     local row,column = guiGridListGetSelectedItem(gridMaps)
  989.     local mapName = guiGridListGetItemText(gridMaps,row,1)
  990.     callServerfunction("buyMap",getLocalPlayer(),mapName)
  991. end
  992.  
  993.  
  994. -- Update labels
  995. function updateMapLabels(updateMode)
  996.     if updateMode == 1 then
  997.         guiSetText(lblTotalMapsOnServer,"Total maps on the server: "..totalServerMaps)
  998.         guiSetText(lblTotalDmMaps,"Total DM Maps:  "..totalDmMaps)
  999.         guiSetText(lblTotalDdMaps,"Total DD Maps:  "..totalDdMaps)
  1000.     else
  1001.         local row,column = guiGridListGetSelectedItem(gridMaps)
  1002.         local mapName = guiGridListGetItemText(gridMaps,row,1)
  1003.         if mapName == "" then
  1004.             guiSetText(lblSelectedMapName,"N/A")
  1005.             guiSetText(lblSelectedMapAuthor,"N/A")
  1006.         else
  1007.             guiSetText(lblSelectedMapName,mapName)
  1008.             if string.find(mapName,"[DM]",1,true) then
  1009.                 guiSetText(lblSelectedMapAuthor,"Deathmatch")
  1010.             elseif string.find(mapName,"[DD]",1,true) then
  1011.                 guiSetText(lblSelectedMapAuthor,"Destruction Derby")
  1012.             elseif string.find(mapName,"[FUN]",1,true) then
  1013.                 guiSetText(lblSelectedMapAuthor,"Fun map")
  1014.             else
  1015.                 guiSetText(lblSelectedMapAuthor,"UNKNOWN")
  1016.             end
  1017.         end
  1018.     end
  1019. end
  1020.    
  1021.    
  1022.     addEventHandler ( "onClientGUIClick", gridMaps, updateMapLabels, false )
  1023.     addEventHandler ( "onClientGUIClick", btnBuyNextMap, buyNextMap, false )
  1024.     addEventHandler ( "onClientGUIChanged", editMapSearch, mapSearch, false )
  1025.    
  1026.    
  1027.    
  1028.    
  1029.    
  1030.    
  1031.    
  1032.    
  1033.     ------------------------------------------
  1034. -- Calling function from the client's side
  1035. ------------------------------------------
  1036.  
  1037. function callClientfunction(funcname, ...)
  1038.     local arg = { ... }
  1039.     if (arg[1]) then
  1040.         for key, value in next, arg do arg[key] = tonumber(value) or value end
  1041.     end
  1042.     loadstring("return "..funcname)()(unpack(arg))
  1043. end
  1044. addEvent("onServerCallsClientFunction", true)
  1045. addEventHandler("onServerCallsClientFunction", resourceRoot, callClientfunction)
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053. -----------------------
  1054. -- Call server function
  1055. -----------------------
  1056.  
  1057. function callServerfunction(funcname, ...)
  1058.     local arg = { ... }
  1059.     if (arg[1]) then
  1060.         for key, value in next, arg do
  1061.             if (type(value) == "number") then arg[key] = tostring(value) end
  1062.         end
  1063.     end
  1064.     triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg))
  1065. end
  1066.    
  1067.    
  1068.    
  1069.    
  1070.    
  1071.    
  1072.    
  1073.    
  1074.    
  1075.    
  1076.    
  1077. -- horns
  1078.    
  1079.  
  1080.  
  1081. -- Horns
  1082. function updateHornsOnStart()
  1083.     callServerfunction("getPurchasedHorns",getLocalPlayer())
  1084.     callServerfunction("getLastSetHorn",getLocalPlayer())
  1085.  
  1086. end
  1087. addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),updateHornsOnStart)
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095. function updateHorns(thePlayer,h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13,h14,h15)
  1096.     guiGridListSetItemColor(gridHorns,0,1,100,255,60,255)
  1097.     guiGridListSetItemColor(gridHorns,0,2,100,255,60,255)
  1098.  
  1099.     if h1 == 1 then
  1100.         guiGridListSetItemColor(gridHorns,1,1,100,255,60,255)
  1101.         guiGridListSetItemColor(gridHorns,1,2,100,255,60,255)
  1102.     end
  1103.  
  1104.     if h2 == 1 then
  1105.         guiGridListSetItemColor(gridHorns,2,1,100,255,60,255)
  1106.         guiGridListSetItemColor(gridHorns,2,2,100,255,60,255)
  1107.     end
  1108.  
  1109.     if h3 == 1 then
  1110.         guiGridListSetItemColor(gridHorns,3,1,100,255,60,255)
  1111.         guiGridListSetItemColor(gridHorns,3,2,100,255,60,255)
  1112.     end
  1113.  
  1114.     if h4 == 1 then
  1115.         guiGridListSetItemColor(gridHorns,4,1,100,255,60,255)
  1116.         guiGridListSetItemColor(gridHorns,4,2,100,255,60,255)
  1117.     end
  1118.  
  1119.     if h5 == 1 then
  1120.         guiGridListSetItemColor(gridHorns,5,1,100,255,60,255)
  1121.         guiGridListSetItemColor(gridHorns,5,2,100,255,60,255)
  1122.     end
  1123.  
  1124.     if h6 == 1 then
  1125.         guiGridListSetItemColor(gridHorns,6,1,100,255,60,255)
  1126.         guiGridListSetItemColor(gridHorns,6,2,100,255,60,255)
  1127.     end
  1128.  
  1129.     if h7 == 1 then
  1130.         guiGridListSetItemColor(gridHorns,7,1,100,255,60,255)
  1131.         guiGridListSetItemColor(gridHorns,7,2,100,255,60,255)
  1132.     end
  1133.  
  1134.     if h8 == 1 then
  1135.         guiGridListSetItemColor(gridHorns,8,1,100,255,60,255)
  1136.         guiGridListSetItemColor(gridHorns,8,2,100,255,60,255)   
  1137.     end
  1138.    
  1139.     if h9 == 1 then
  1140.         guiGridListSetItemColor(gridHorns,9,1,100,255,60,255)
  1141.         guiGridListSetItemColor(gridHorns,9,2,100,255,60,255)   
  1142.     end
  1143.     if h10 == 1 then
  1144.         guiGridListSetItemColor(gridHorns,10,1,100,255,60,255)
  1145.         guiGridListSetItemColor(gridHorns,10,2,100,255,60,255) 
  1146.     end
  1147.         if h11 == 1 then
  1148.         guiGridListSetItemColor(gridHorns,11,1,100,255,60,255)
  1149.         guiGridListSetItemColor(gridHorns,11,2,100,255,60,255) 
  1150.     end
  1151.             if h12 == 1 then
  1152.         guiGridListSetItemColor(gridHorns,12,1,100,255,60,255)
  1153.         guiGridListSetItemColor(gridHorns,12,2,100,255,60,255) 
  1154.     end
  1155.                 if h13 == 1 then
  1156.         guiGridListSetItemColor(gridHorns,13,1,100,255,60,255)
  1157.         guiGridListSetItemColor(gridHorns,13,2,100,255,60,255) 
  1158.     end
  1159.                     if h14 == 1 then
  1160.         guiGridListSetItemColor(gridHorns,14,1,100,255,60,255)
  1161.         guiGridListSetItemColor(gridHorns,14,2,100,255,60,255) 
  1162.     end
  1163.                         if h15 == 1 then
  1164.         guiGridListSetItemColor(gridHorns,15,1,100,255,60,255)
  1165.         guiGridListSetItemColor(gridHorns,15,2,100,255,60,255) 
  1166.     end
  1167.                             if h16 == 1 then
  1168.         guiGridListSetItemColor(gridHorns,16,1,100,255,60,255)
  1169.         guiGridListSetItemColor(gridHorns,16,2,100,255,60,255) 
  1170.     end
  1171.    
  1172.    
  1173. end
  1174. addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),updateHorns)
  1175.  
  1176.  
  1177.  
  1178. function setLastUsedHorn(horn)
  1179.     if not (horn == 0) then
  1180.         setHornSound = horn
  1181.         toggleControl("horn",false)
  1182.         guiSetText(lblCurrentHorn,""..hornName[horn+1])
  1183.     else
  1184.         toggleControl("horn",true)
  1185.         guiSetText(lblCurrentHorn,"Normal Korna")
  1186.     end
  1187.     bindKey ("h", "down", playCustomHorn)
  1188.  
  1189.  
  1190. end
  1191.  
  1192.  
  1193.  
  1194. function hornPreview()
  1195.     local selectedHorn = guiGridListGetSelectedItem(gridHorns)
  1196.     if selectedHorn <= 0 then
  1197.         return
  1198.     end
  1199.     if selectedHorn == 6 then
  1200.         local previewHorn = playSound(hornSound[selectedHorn])
  1201.         setSoundVolume(previewHorn,0.6)
  1202.     else
  1203.         local previewHorn = playSound(hornSound[selectedHorn])
  1204.         setSoundVolume(previewHorn,0.8)
  1205.     end
  1206. end
  1207.  
  1208.  
  1209.  
  1210. function buyHorn()
  1211.     local selectedHorn = guiGridListGetSelectedItem(gridHorns)
  1212.     if selectedHorn == -1 then
  1213.         outputChatBox("#ff6600Lütfen alınacak kornayı seçin",255,255,255,true)
  1214.         return
  1215.     end
  1216.     if selectedHorn == 0 then
  1217.         outputChatBox("#ff6600Bu korna saten alınmış.",255,255,255,true)
  1218.         return
  1219.     end
  1220.     callServerfunction("purchaseHorn",getLocalPlayer(),selectedHorn,hornName[selectedHorn+1])
  1221. end
  1222.  
  1223.  
  1224. function setHornCheck()
  1225.     local selectedHorn = guiGridListGetSelectedItem(gridHorns)
  1226.     if selectedHorn == -1 then
  1227.         outputChatBox("#ff6600Lütfen kornayı seçin",255,255,255,true)
  1228.         return
  1229.     end
  1230.     if selectedHorn == 0 then
  1231.         outputChatBox("#ff6600 Selected is no longer horn Horn #ABCDEF"..hornName[selectedHorn+1],255,255,255,true)
  1232.         callServerfunction("setLastSetHorn",getLocalPlayer(),selectedHorn)
  1233.         setHornSound = 0
  1234.         toggleControl("horn",true)
  1235.         guiSetText(lblCurrentHorn,"Normal Korna")
  1236.         return
  1237.     end
  1238.     callServerfunction("checkForPurchasedHorn",getLocalPlayer(),selectedHorn)
  1239. end
  1240.  
  1241.  
  1242.  
  1243. function setHorn(horn)
  1244.     outputChatBox("#ff6600 Selected is no longer horn Horn#ABCDEF"..hornName[horn+1],255,255,255,true)
  1245.     callServerfunction("setLastSetHorn",getLocalPlayer(),horn)
  1246.     toggleControl("horn",false)
  1247.     setHornSound = horn
  1248.     guiSetText(lblCurrentHorn,""..hornName[horn+1])
  1249. end
  1250.  
  1251. function updateHornPriceLabel()
  1252.     local row = guiGridListGetSelectedItem(gridHorns)
  1253.     if (row > 0) then
  1254.         local price = guiGridListGetItemText(gridHorns,row,2)
  1255.         guiSetText(lblHornPrice,"$"..string.gsub(price," ",""))
  1256.     else
  1257.         guiSetText(lblHornPrice,"N/A")
  1258.     end
  1259. end
  1260.  
  1261.  
  1262.  
  1263.  
  1264. -- Play the actual horn sound
  1265. function playCustomHorn()
  1266.     if isControlEnabled("horn") == false then
  1267.         if getElementData(getLocalPlayer(),"state") == "alive" then
  1268.             if hornNum == 0 then
  1269.                 callServerfunction("playHornForAllClients",getLocalPlayer(),tostring(hornSound[setHornSound]),setHornSound)
  1270.             end
  1271.         end
  1272.     elseif setHornSound ~= 0 then
  1273.         toggleControl("horn",false)
  1274.         playCustomHorn()
  1275.     end
  1276. end
  1277.  
  1278.  
  1279. function playCustomHornxx()
  1280.     if isControlEnabled("horn") == false then
  1281.         if setHornSound == 0 then
  1282.             toggleControl("horn",true)
  1283.             playCustomHorn()
  1284.             return
  1285.         end
  1286.         if getElementCacheData(getLocalPlayer(),"state") == "alive" then
  1287.             if hornNum == 0 then
  1288.                 callServerfunction("playHornForAllClients",getLocalPlayer(),tostring(hornSound[setHornSound]),setHornSound)
  1289.             end
  1290.         end
  1291.     elseif setHornSound ~= 0 then
  1292.         toggleControl("horn",false)
  1293.         playCustomHorn()
  1294.     end
  1295. end
  1296.  
  1297.  
  1298.  
  1299. function playHornSound(horningPlayer,hornSoundPath,cSetHornSound)
  1300.     local numItems = 0
  1301.     for k,v in pairs(customHorn) do
  1302.         numItems = numItems + 1
  1303.     end
  1304.     if (cSetHornSound ~= 0) then
  1305.  
  1306.         customHorn[numItems+1] = playSound3D(hornSoundPath,getElementPosition(horningPlayer))
  1307.  
  1308.         if horningPlayer == getLocalPlayer() then
  1309.             hornNum = numItems+1
  1310.         else
  1311.             hornNum = 0
  1312.         end
  1313.  
  1314.         setSoundMaxDistance(customHorn[numItems+1],75)
  1315.  
  1316.         setSoundVolume(customHorn[numItems+1],0.95)
  1317.  
  1318.         attachElements(customHorn[numItems+1],horningPlayer,0,0,0.5)
  1319.  
  1320.         local length = getSoundLength(customHorn[numItems+1])
  1321.  
  1322.         detachTimer = setTimer(
  1323.             function()
  1324.                 if (customHorn[numItems+1]) then
  1325.                     if isElementAttached(customHorn[numItems+1]) == true then
  1326.                         detachElements(customHorn[numItems+1])
  1327.                     end
  1328.                     stopSound(customHorn[numItems+1])
  1329.                 end
  1330.                 customHorn[numItems+1] = nil
  1331.                 hornNum = 0
  1332.             end,length*1000 - 100,1)
  1333.     end
  1334. end
  1335. addEvent("onRecieveHorn",true)
  1336. addEventHandler("onRecieveHorn",getRootElement(),playHornSound)
  1337.  
  1338. --setTimer ( playHornSound, 1000, 1,  )
  1339.  
  1340.    
  1341.    
  1342.    
  1343. -------------------------------------------------------------------------- 
  1344.    
  1345.    
  1346.    
  1347.    
  1348. --------------------------------------------------------------------------------------------------
  1349.  
  1350.   --general--
  1351.   local root = getRootElement()
  1352.   local resRoot = getResourceRootElement(getThisResource())
  1353.   local localPlayer = getLocalPlayer()
  1354.   --end general--
  1355.  
  1356.   --distance--
  1357.   local distanceTravelled
  1358.   local oldx,oldy,oldz
  1359.   --end distance--
  1360. --[[*************************************************
  1361. *        Part I: sounds                             *
  1362. *****************************************************]]
  1363.  
  1364. --PLAY UEFA SOUND
  1365. function playUefaSoundForPlayer(forAll)
  1366.     if (forAll) then
  1367.         playSound("/files/uefa.mp3",false)
  1368.     else
  1369.         if (source == localPlayer) then
  1370.             playSound("/files/uefa.mp3",false)
  1371.         else
  1372.             local x,y,z = getElementPosition(source)
  1373.             local sound = playSound3D("/files/uefa.mp3",x,y,z,false)
  1374.             setSoundMinDistance(sound,5)
  1375.             setSoundMaxDistance(sound,40)
  1376.             attachElements(sound,source)
  1377.         end
  1378.     end
  1379. end
  1380. addEvent("onPlayerPlayUEFASound", true)
  1381. addEventHandler("onPlayerPlayUEFASound", root, playUefaSoundForPlayer)
  1382.  
  1383. --PUBLIC MESSAGE FOR ALL PLAYERS
  1384. local pmsgtexts = {}
  1385. function displayPMSG(msg)
  1386.     local tick = getTickCount()
  1387.     local msg = "|"..getPlayerName(source).."#FF7800|: " ..msg
  1388.     table.insert(pmsgtexts,{tostring(msg), tick})
  1389.     if (#pmsgtexts == 1) then
  1390.         addEventHandler("onClientRender", getRootElement(), pmsgdraw_func)
  1391.     end
  1392. end
  1393.  
  1394. local sw,sh = guiGetScreenSize()
  1395. function pmsgdraw_func()
  1396.     local tick2 = getTickCount()
  1397.     if (#pmsgtexts < 1) then
  1398.         removeEventHandler("onClientRender", getRootElement(), pmsgdraw_func)
  1399.     end
  1400.     for i,v in ipairs(pmsgtexts) do
  1401.         if tick2 - pmsgtexts[i][2] < 6000 then
  1402.             dxDrawColorText( true, pmsgtexts[i][1], sw/2, sh/2, sw/2, sh/2, tocolor(255,102,0), 1.25, "bankgothic", "center")
  1403.         else
  1404.             table.remove(pmsgtexts,i)
  1405.         end
  1406.     end
  1407. end
  1408.  
  1409. addEvent("onAdminSendPMSG", true)
  1410. addEventHandler("onAdminSendPMSG", getRootElement(), displayPMSG)
  1411.  
  1412. --[[*************************************************
  1413. *        Part II: client events/functions            *
  1414. *****************************************************]]
  1415.  
  1416. function playerRankUp()
  1417.     if source == localPlayer then
  1418.         playSound("/files/RankUp.mp3",false)
  1419.     else
  1420.         local x,y,z = getElementPosition(source)
  1421.         local sound = playSound3D("/files/RankUp.mp3",x,y,z,false)
  1422.         setSoundMinDistance(sound,5)
  1423.         setSoundMaxDistance(sound,40)
  1424.         attachElements(sound,source)
  1425.     end
  1426. end
  1427. addEvent("onPlayerRankUp",true)
  1428. addEventHandler("onPlayerRankUp",root,playerRankUp)
  1429.  
  1430. --[[function startRecordingDistanceTravelled()
  1431.     distanceTravelled = 0
  1432.     addEventHandler("onClientRender",root,distanceRecord)
  1433. end
  1434. addEvent("startRecordingDistanceTravelled",true)
  1435. addEventHandler("startRecordingDistanceTravelled",root,startRecordingDistanceTravelled)
  1436.  
  1437. function getRecordedDistanceTravelled(stop)
  1438.     triggerServerEvent("onDistanceTravelledReturn",localPlayer,distanceTravelled)
  1439.     distanceTravelled = 0
  1440.     if stop then
  1441.         removeEventHandler("onClientRender",root,distanceRecord)
  1442.     end
  1443. end
  1444. addEvent("getRecordedDistanceTravelled",true)
  1445. addEventHandler("getRecordedDistanceTravelled",root,getRecordedDistanceTravelled)
  1446.  
  1447. function resourceStop()
  1448.     if distanceTravelled > 0 then
  1449.         triggerServerEvent("onDistanceTravelledReturn",localPlayer,distanceTravelled)
  1450.     end
  1451. end
  1452. addEventHandler("onClientResourceStop",resRoot,resourceStop)
  1453.  
  1454. function distanceRecord()
  1455.     local veh = getPedOccupiedVehicle(getLocalPlayer())
  1456.     if veh then
  1457.         local x,y,z = getElementPosition(veh)
  1458.         if oldx then
  1459.             distanceTravelled = distanceTravelled + getDistanceBetweenPoints3D(x,y,z,oldx,oldy,oldz)
  1460.         end
  1461.         oldx,oldy,oldz = x,y,z
  1462.     end
  1463. end]]
  1464.  
  1465. --[[*************************************************
  1466. *        Part III: disco functions                  *
  1467. *****************************************************]]
  1468. local cr,cg,cb
  1469. local polilight
  1470. local cablight
  1471.  
  1472.  
  1473.  
  1474. addEvent("onAtzenFun",true)
  1475. addEventHandler("onAtzenFun",getRootElement(),
  1476.   function ()
  1477.      playSound("disco_pogo.mp3")
  1478.     local vehic = getPedOccupiedVehicle ( getLocalPlayer() )
  1479.        if ( vehic ) then
  1480.        cr,cg,cb = getVehicleHeadLightColor(vehic)
  1481.        local polilight = getVehicleSirensOn(vehic)
  1482.        local cablight = isVehicleTaxiLightOn(vehic)
  1483.         triggerServerEvent("globalSirensOn",getRootElement(),vehic,true)
  1484.         triggerServerEvent("globalTaxiLight",getRootElement(),vehic,true)
  1485.         setTimer(party,300,46)
  1486.         setTimer(orig,(300*46+3000),1)
  1487.       end
  1488.   end
  1489. )
  1490.  
  1491. function party()
  1492.    local vehic = getPedOccupiedVehicle ( getLocalPlayer() )
  1493.        if ( vehic ) then
  1494.          triggerServerEvent("globalTaxiLight",getRootElement(),vehic,not isVehicleTaxiLightOn(vehic))
  1495.       triggerServerEvent("globalLightColor",getRootElement(),vehic,math.random(0,255),math.random(0,255),math.random(0,255))
  1496.      end
  1497. end
  1498.  
  1499. function orig()
  1500.     local vehic = getPedOccupiedVehicle ( getLocalPlayer() )
  1501.        if ( vehic ) then
  1502.        triggerServerEvent("globalLightColor",getRootElement(),vehic,cr,cg,cb)
  1503.        triggerServerEvent("globalSirensOn",getRootElement(),vehic,polilight)
  1504.        triggerServerEvent("globalTaxiLight",getRootElement(),vehic,not cablight)
  1505.      end
  1506.  
  1507. end
  1508.  
  1509. --[[*************************************************
  1510. *        Part IV: 2D countdown                      *
  1511. *****************************************************]]
  1512.  
  1513. local instructionText
  1514. function showCursorForStart()
  1515.     if (source == localPlayer) then
  1516.         showCursor(true)
  1517.         instructionText = dxText:create("Please Click somewhere on your screen where you want the countdown to appear!", 0.5, 0.6, true, "sans", 2, "center")
  1518.         instructionText:color(0,255, 55)
  1519.  
  1520.         setTimer(
  1521.         function()
  1522.         instructionText:destroy()
  1523.         end
  1524.         , 5000, 1)
  1525.  
  1526.         addEventHandler("onClientClick", root, onPlayerClickReturnPosition)
  1527.     end
  1528. end
  1529. addEvent("onPlayerUseCountdown", true)
  1530. addEventHandler("onPlayerUseCountdown", root, showCursorForStart)
  1531.  
  1532. function onPlayerClickReturnPosition(btn, state, sx, sy, x, y, z, element)
  1533.     if (btn == "left") and (state == "down") then
  1534.         removeEventHandler("onClientClick", root, onPlayerClickReturnPosition)
  1535.         local startTime = getTickCount()
  1536.         showCursor(false)
  1537.         triggerServerEvent("onPlayerClickDrawCountdownSendServer",root, x, y, z, element)
  1538.     end
  1539. end
  1540.  
  1541. function drawCountdownInWorld(px, py, pz,element)
  1542.     local nx, ny, nz = getCameraMatrix(localPlayer)
  1543.     local between = getDistanceBetweenPoints3D(px, py, pz, nx, ny, nz)
  1544.     local start = getTickCount()
  1545.     if (between < 125) then
  1546.         setTimer(playSoundFrontEnd, 1000, 1, 44)
  1547.         setTimer(playSoundFrontEnd, 2000, 1, 44)
  1548.         setTimer(playSoundFrontEnd, 3000, 1, 44)
  1549.         setTimer(playSoundFrontEnd, 4000, 1, 44)
  1550.         setTimer(playSoundFrontEnd, 5000, 1, 44)
  1551.         setTimer(playSoundFrontEnd, 6000, 1, 45)
  1552.     end
  1553.     function drawCd()
  1554.         local sx,sy = getScreenFromWorldPosition(px,py,pz+5,0.06)
  1555.         local timePassed = getTickCount() - start
  1556.         if sx and sy then
  1557.             local cx,cy,cz = getCameraMatrix()
  1558.             local size = getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz)
  1559.             local pixel = 200 - size*2
  1560.             if size <= 125 then
  1561.                 if (timePassed > 1000) and (timePassed < 1500) then
  1562.                     dxDrawImage(sx-(pixel*0.5),sy-(pixel*0.5),pixel,pixel,"files/5.png")
  1563.                 elseif (timePassed > 2000) and (timePassed <2500) then
  1564.                     dxDrawImage(sx-(pixel*0.5),sy-(pixel*0.5),pixel,pixel,"files/4.png")
  1565.                 elseif (timePassed > 3000) and (timePassed < 3500) then
  1566.                     dxDrawImage(sx-(pixel*0.5),sy-(pixel*0.5),pixel,pixel,"files/3.png")
  1567.                 elseif (timePassed > 4000) and (timePassed <4500) then
  1568.                     dxDrawImage(sx-(pixel*0.5),sy-(pixel*0.5),pixel,pixel,"files/2.png")
  1569.                 elseif (timePassed > 5000) and (timePassed <5500) then
  1570.                     dxDrawImage(sx-(pixel*0.5),sy-(pixel*0.5),pixel,pixel,"files/1.png")
  1571.                 elseif (timePassed > 6000) and (timePassed <9000) then
  1572.                     dxDrawImage(sx-(pixel*0.5),sy-(pixel*0.5),pixel,pixel,"files/go.png")
  1573.                 elseif (timePassed > 9000) then
  1574.                     triggerServerEvent("onClientStopCountdown", root)
  1575.                     triggerServerEvent("getplayername", localPlayer, timePassed)
  1576.                     removeEventHandler("onClientRender", root, drawCd)
  1577.                 else
  1578.                     --nothing
  1579.                 end
  1580.             else
  1581.                 if (timePassed > 9000) then
  1582.                     triggerServerEvent("onClientStopCountdown", root)
  1583.                     triggerServerEvent("getplayername", localPlayer, timePassed)
  1584.                     removeEventHandler("onClientRender", root, drawCd)
  1585.                 end
  1586.             end
  1587.         else
  1588.             if (timePassed > 9000) then
  1589.                 triggerServerEvent("onClientStopCountdown", root)
  1590.                 triggerServerEvent("getplayername", localPlayer, timePassed)
  1591.                 removeEventHandler("onClientRender", root, drawCd)
  1592.             end
  1593.         end
  1594.     end
  1595.     addEventHandler("onClientRender", root, drawCd)
  1596.     function onPlayerQuitCD()
  1597.         triggerServerEvent("onClientStopCountdown", source)
  1598.     end
  1599.     addEventHandler("onClientResourceStop", resRoot, onPlayerQuitCD)
  1600. end
  1601. addEvent("onPlayerClickDrawCountdown", true)
  1602. addEventHandler("onPlayerClickDrawCountdown", root, drawCountdownInWorld)
  1603.  
  1604. --[[*************************************************
  1605. *        Part V: Ghostmode                          *
  1606. *****************************************************]]
  1607. --[[
  1608. local width, height = 175, 35
  1609. local gmimage
  1610. local screenWidth, screenHeight = guiGetScreenSize()
  1611. local path = "files/ghostmode.png"
  1612.  
  1613. addEventHandler("onClientResourceStart", resRoot,
  1614. function()
  1615.     gmimage = guiCreateStaticImage(screenWidth/2 - 75, 65, width, height, "files/ghostmode.png", false)
  1616. end)
  1617.  
  1618. addEventHandler("onClientRender", root,
  1619. function()
  1620.     dxDrawImage(screenWidth/2 - 70, 60, width, height, path)
  1621. end)
  1622.  
  1623. function switchGhostModeImage(mapinfo, mapMode)
  1624.     local mapType = mapinfo.modename
  1625.     if (mapType == "Destruction derby") then
  1626.         if (mapMode == "DM") then
  1627.             --guiStaticImageLoadImage(gmimage, "files/ghostmode_on.png")
  1628.             path = "files/ghostmode_on.png"
  1629.         elseif (mapMode == "DD") then
  1630.             --guiStaticImageLoadImage(gmimage, "files/ghostmode_off.png")
  1631.             path = "files/ghostmode_off.png"
  1632.         end
  1633.     else
  1634.         --guiStaticImageLoadImage(gmimage, "files/ghostmode_on.png")
  1635.         path = "files/ghostmode_on.png"
  1636.     end
  1637. end
  1638. addEvent("onClientDestructionDerbyModeMapStart", true)
  1639. addEventHandler("onClientDestructionDerbyModeMapStart", root, switchGhostModeImage)
  1640.  
  1641. function toggleGhostmodeByAdmin(gm)
  1642.     if (gm) then
  1643.         --guiStaticImageLoadImage(gmimage, "files/ghostmode_on.png")
  1644.         path = "files/ghostmode_on.png"
  1645.     else
  1646.         --guiStaticImageLoadImage(gmimage, "files/ghostmode_off.png")
  1647.         path = "files/ghostmode_off.png"
  1648.     end
  1649. end
  1650. addEvent("onClientAdminToggleGhostmode", true)
  1651. addEventHandler("onClientAdminToggleGhostmode", root, toggleGhostmodeByAdmin)]]
  1652.  
  1653. local counter = 0
  1654. local starttick
  1655. local currenttick
  1656. addEventHandler("onClientRender",getRootElement(),
  1657.     function()
  1658.         if not starttick then
  1659.             starttick = getTickCount()
  1660.         end
  1661.         counter = counter + 1
  1662.         currenttick = getTickCount()
  1663.         if currenttick - starttick >= 1000 then
  1664.             setElementData(getLocalPlayer(),"fps",counter)
  1665.             counter = 0
  1666.             starttick = false
  1667.         end
  1668.     end
  1669. )
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679. function sol()
  1680.     if (guiGetVisible (Gui_Image1) == true) then
  1681.         guiSetVisible (Gui_Image1, false)
  1682.         guiSetVisible(Gui_Image2,true)
  1683.         guiSetText (Gui_JantLabel, "2 / 16")
  1684.     elseif (guiGetVisible (Gui_Image2) == true) then
  1685.         guiSetVisible (Gui_Image2, false)
  1686.         guiSetVisible(Gui_Image3,true)
  1687.         guiSetText (Gui_JantLabel, "3 / 16")
  1688.     elseif (guiGetVisible (Gui_Image3) == true) then
  1689.         guiSetVisible (Gui_Image3, false)
  1690.         guiSetVisible(Gui_Image4,true)
  1691.         guiSetText (Gui_JantLabel, "4 / 16")
  1692.     elseif (guiGetVisible (Gui_Image4) == true) then
  1693.         guiSetVisible (Gui_Image4, false)
  1694.         guiSetVisible(Gui_Image5,true)
  1695.         guiSetText (Gui_JantLabel, "5 / 16")
  1696.     elseif (guiGetVisible (Gui_Image5) == true) then
  1697.         guiSetVisible (Gui_Image5, false)
  1698.         guiSetVisible(Gui_Image6,true)
  1699.         guiSetText (Gui_JantLabel, "6 / 16")
  1700.     elseif (guiGetVisible (Gui_Image6) == true) then
  1701.         guiSetVisible (Gui_Image6, false)
  1702.         guiSetVisible(Gui_Image7,true)
  1703.         guiSetText (Gui_JantLabel, "7 / 16")
  1704.     elseif (guiGetVisible (Gui_Image7) == true) then
  1705.         guiSetVisible (Gui_Image7, false)
  1706.         guiSetVisible(Gui_Image8,true)
  1707.         guiSetText (Gui_JantLabel, "8 / 16")
  1708.     elseif (guiGetVisible (Gui_Image8) == true) then
  1709.         guiSetVisible (Gui_Image8, false)
  1710.         guiSetVisible(Gui_Image9,true)
  1711.         guiSetText (Gui_JantLabel, "9 / 16")
  1712.     elseif (guiGetVisible (Gui_Image9) == true) then
  1713.         guiSetVisible (Gui_Image9, false)
  1714.         guiSetVisible(Gui_Image10,true)
  1715.         guiSetText (Gui_JantLabel, "10 / 16")
  1716.     elseif (guiGetVisible (Gui_Image10) == true) then
  1717.         guiSetVisible (Gui_Image10, false)
  1718.         guiSetVisible(Gui_Image11,true)
  1719.         guiSetText (Gui_JantLabel, "11 / 16")
  1720.     elseif (guiGetVisible (Gui_Image11) == true) then
  1721.         guiSetVisible (Gui_Image11, false)
  1722.         guiSetVisible(Gui_Image12,true)
  1723.         guiSetText (Gui_JantLabel, "12 / 16")
  1724.     elseif (guiGetVisible (Gui_Image12) == true) then
  1725.         guiSetVisible (Gui_Image12, false)
  1726.         guiSetVisible(Gui_Image13,true)
  1727.         guiSetText (Gui_JantLabel, "13 / 16")
  1728.     elseif (guiGetVisible (Gui_Image13) == true) then
  1729.         guiSetVisible (Gui_Image13, false)
  1730.         guiSetVisible(Gui_Image14,true)
  1731.         guiSetText (Gui_JantLabel, "14 / 16")
  1732.     elseif (guiGetVisible (Gui_Image14) == true) then
  1733.         guiSetVisible (Gui_Image14, false)
  1734.         guiSetVisible(Gui_Image15,true)
  1735.         guiSetText (Gui_JantLabel, "15 / 16")
  1736.     elseif (guiGetVisible (Gui_Image15) == true) then
  1737.         guiSetVisible (Gui_Image15, false)
  1738.         guiSetVisible(Gui_Image16,true)
  1739.         guiSetText (Gui_JantLabel, "16 / 16")
  1740.     end
  1741. end
  1742.  
  1743.  
  1744. function sam()
  1745.     if (guiGetVisible (Gui_Image16) == true) then
  1746.         guiSetVisible (Gui_Image16, false)
  1747.         guiSetVisible(Gui_Image15,true)
  1748.         guiSetText (Gui_JantLabel, "15 / 16")
  1749.     elseif (guiGetVisible (Gui_Image15) == true) then
  1750.         guiSetVisible (Gui_Image15, false)
  1751.         guiSetVisible(Gui_Image14,true)
  1752.         guiSetText (Gui_JantLabel, "14 / 16")
  1753.     elseif (guiGetVisible (Gui_Image14) == true) then
  1754.         guiSetVisible (Gui_Image14, false)
  1755.         guiSetVisible(Gui_Image13,true)
  1756.         guiSetText (Gui_JantLabel, "13 / 16")
  1757.     elseif (guiGetVisible (Gui_Image13) == true) then
  1758.         guiSetVisible (Gui_Image13, false)
  1759.         guiSetVisible(Gui_Image12,true)
  1760.         guiSetText (Gui_JantLabel, "12 / 16")
  1761.     elseif (guiGetVisible (Gui_Image12) == true) then
  1762.         guiSetVisible (Gui_Image12, false)
  1763.         guiSetVisible(Gui_Image11,true)
  1764.         guiSetText (Gui_JantLabel, "11 / 16")
  1765.     elseif (guiGetVisible (Gui_Image11) == true) then
  1766.         guiSetVisible (Gui_Image11, false)
  1767.         guiSetVisible(Gui_Image10,true)
  1768.         guiSetText (Gui_JantLabel, "10 / 16")
  1769.     elseif (guiGetVisible (Gui_Image10) == true) then
  1770.         guiSetVisible (Gui_Image10, false)
  1771.         guiSetVisible(Gui_Image9,true)
  1772.         guiSetText (Gui_JantLabel, "9 / 16")
  1773.     elseif (guiGetVisible (Gui_Image9) == true) then
  1774.         guiSetVisible (Gui_Image9, false)
  1775.         guiSetVisible(Gui_Image8,true)
  1776.         guiSetText (Gui_JantLabel, "8 / 16")
  1777.     elseif (guiGetVisible (Gui_Image8) == true) then
  1778.         guiSetVisible (Gui_Image8, false)
  1779.         guiSetVisible(Gui_Image7,true)
  1780.         guiSetText (Gui_JantLabel, "7 / 16")
  1781.     elseif (guiGetVisible (Gui_Image7) == true) then
  1782.         guiSetVisible (Gui_Image7, false)
  1783.         guiSetVisible(Gui_Image6,true)
  1784.         guiSetText (Gui_JantLabel, "6 / 16")
  1785.     elseif (guiGetVisible (Gui_Image6) == true) then
  1786.         guiSetVisible (Gui_Image6, false)
  1787.         guiSetVisible(Gui_Image5,true)
  1788.         guiSetText (Gui_JantLabel, "5 / 16")
  1789.     elseif (guiGetVisible (Gui_Image5) == true) then
  1790.         guiSetVisible (Gui_Image5, false)
  1791.         guiSetVisible(Gui_Image4,true)
  1792.         guiSetText (Gui_JantLabel, "4 / 16")
  1793.     elseif (guiGetVisible (Gui_Image4) == true) then
  1794.         guiSetVisible (Gui_Image4, false)
  1795.         guiSetVisible(Gui_Image3,true)
  1796.         guiSetText (Gui_JantLabel, "3 / 16")
  1797.     elseif (guiGetVisible (Gui_Image3) == true) then
  1798.         guiSetVisible (Gui_Image3, false)
  1799.         guiSetVisible(Gui_Image2,true)
  1800.         guiSetText (Gui_JantLabel, "2 / 16")
  1801.     elseif (guiGetVisible (Gui_Image2) == true) then
  1802.         guiSetVisible (Gui_Image2, false)
  1803.         guiSetVisible(Gui_Image1,true)
  1804.         guiSetText (Gui_JantLabel, "1 / 16")
  1805.     end
  1806. end
  1807.  
  1808. function replaceModel()
  1809.   txd = engineLoadTXD("wheel_sr6.dff", 1073 )
  1810.   engineImportTXD(txd, 411)
  1811.   dff = engineLoadDFF("wheel_sr6.txd", 1073 )
  1812.   engineReplaceModel(dff, 411)
  1813. end
  1814. addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel)
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822. function save()
  1823.     if (guiGetVisible (Gui_Image1) == true) then
  1824.     callServerfunction("buyjant",getLocalPlayer(),1098)
  1825.    
  1826.     elseif (guiGetVisible (Gui_Image2) == true) then
  1827.     callServerfunction("buyjant",getLocalPlayer(),1073)
  1828.    
  1829.     elseif (guiGetVisible (Gui_Image3) == true) then
  1830.     callServerfunction("buyjant",getLocalPlayer(),1074)
  1831.    
  1832.     elseif (guiGetVisible (Gui_Image4) == true) then
  1833.     callServerfunction("buyjant",getLocalPlayer(),1075)
  1834.    
  1835.     elseif (guiGetVisible (Gui_Image5) == true) then
  1836.     callServerfunction("buyjant",getLocalPlayer(),1076)
  1837.    
  1838.     elseif (guiGetVisible (Gui_Image6) == true) then
  1839.     callServerfunction("buyjant",getLocalPlayer(),1077)
  1840.    
  1841.     elseif (guiGetVisible (Gui_Image7) == true) then
  1842.     callServerfunction("buyjant",getLocalPlayer(),1078)
  1843.    
  1844.     elseif (guiGetVisible (Gui_Image8) == true) then
  1845.     callServerfunction("buyjant",getLocalPlayer(),1079)
  1846.    
  1847.     elseif (guiGetVisible (Gui_Image9) == true) then
  1848.     callServerfunction("buyjant",getLocalPlayer(),1080)
  1849.    
  1850.     elseif (guiGetVisible (Gui_Image10) == true) then
  1851.     callServerfunction("buyjant",getLocalPlayer(),1081)
  1852.    
  1853.     elseif (guiGetVisible (Gui_Image11) == true) then
  1854.     callServerfunction("buyjant",getLocalPlayer(),1082)
  1855.    
  1856.     elseif (guiGetVisible (Gui_Image12) == true) then
  1857.     callServerfunction("buyjant",getLocalPlayer(),1083)
  1858.    
  1859.     elseif (guiGetVisible (Gui_Image13) == true) then
  1860.     callServerfunction("buyjant",getLocalPlayer(),1084)
  1861.    
  1862.     elseif (guiGetVisible (Gui_Image14) == true) then
  1863.     callServerfunction("buyjant",getLocalPlayer(),1085)
  1864.    
  1865.     elseif (guiGetVisible (Gui_Image15) == true) then
  1866.     callServerfunction("buyjant",getLocalPlayer(),1096)
  1867.    
  1868.     elseif (guiGetVisible (Gui_Image16) == true) then
  1869.     callServerfunction("buyjant",getLocalPlayer(),1097)
  1870.    
  1871.  
  1872.    
  1873.     end
  1874. end 
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  [/code]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement