Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gRoot = getRootElement()
- sW,sH = guiGetScreenSize()
- local sx, sy = guiGetScreenSize()
- myCash = "???"
- myWinsDD = "???"
- myWinsDM = "???"
- myPlayedDD = "???"
- myPlayedDM = "???"
- myRatioDD = "???"
- myRatioDM = "???"
- myPlayedTime = "???"
- myHunters = "???"
- myMapBuys = "???"
- myACCount = "???"
- myTopTimes = "???"
- --[[totalBets = "N/A"
- totalBetsWon = "N/A"]]--
- --[[mapAuthor = "Unknow"
- mapName = "N/A"
- mapType = "N/A"
- totalMaps = "N/A"]]--
- topButton = {}
- topButtons = {}
- topButtons[1] = {"Top Cash","cash"}
- topButtons[2] = {"Top Achievements","achievements"}
- topButtons[3] = {"Top DDs","dds"}
- topButtons[4] = {"Top DMs","dms"}
- topButtons[5] = {"Top DD wins","ddwins"}
- topButtons[6] = {"Top DM wins","dmwins"}
- topButtons[7] = {"Top DD ratio","ddratio"}
- topButtons[8] = {"Top DM ratio","dmratio"}
- topButtons[9] = {"Top Map Buys","mapbuys"}
- topButtons[10] = {"Top Played Time","playedtime"}
- topButtons[11] = {"Top Hunters","hunters"}
- topButtons[12] = {"Top TopTimes","toptimes"}
- topButtons[13] = {"Top DD Map","ddmap"}
- topButtons[14] = {"Top DM Map","dmmap"}
- shaders = {}
- shaderCheckBox = {}
- shaderNames ={
- "Car Shader",
- "Water Shader",
- "Surface Reflections",
- "Contrast",
- "Snow",
- "Gold",
- "Colored Skidmarks"
- }
- shaderHelpNames = {
- "Realistic vehicle reflections",
- "Realistic water texture and reflections",
- "Realistic surface texture and reflections",
- "HDR Contrast Shader",
- "Adds snow on roads and trees",
- "Feel like King Midas",
- "Useless..."
- }
- -- Create horns
- hornName={
- "Default GTA horn",
- "Airhorn",
- "Clown",
- "Train",
- "Fog horn",
- "Submarine",
- "Military trumpet",
- "Mr. Whoopie"}
- hornPrice={
- " N/A",
- " 2000",
- " 4000",
- " 6000",
- " 8000",
- " 10000",
- " 15000",
- " 20000"}
- hornSound={
- "sounds/airhorn.wav",
- "sounds/clownhorn.mp3",
- "sounds/trainhorn.mp3",
- "sounds/cargoshiphorn.mp3",
- "sounds/submarinehorn.wav",
- "sounds/generalleehorn.mp3",
- "sounds/whoopiehorn.mp3"}
- PlayerDataGUI={}
- UserDataGUI={}
- UserDataNames={
- "Name","Age","BirthDay","Country","Languages","City","Family","Pets","Boyfriend","GirlFriend","E-mail","GG","ICQ","MSN","Site","Hobby","Interest","Fav. Car","Games","PC"
- }
- Achievement = {}
- AchievementImages = {}
- AchievementsName = {
- "First Win!", -- 1sze zwyciestwo 1
- "First Hunter!", -- 1szy hunter 2
- "Top Winner!", -- 300 wins 3
- "Awesome Winner!", -- 1000 wins 4
- "Top Gamer!", -- 2000 map 5
- "Long Time Player!", -- 7 dni 6
- "Hunter Owner!", -- hunter 50 razy 7
- "Beat my TT kid!", -- pierwszy TT 8
- "5 Maps In a Row LOL!", -- 5x 9
- "Triple Deathmatch!", -- 3x dm pod rzad 10
- "Triple Dest. Derby!", -- 3x DD 11
- "Hunter Power", -- hunterfight z 3 graczami 12
- "Map Buyer", -- 10 razy kupic mape 13
- "Top Times collector!", -- 50 toptimow 14
- "Rich player!", -- 1 mln 15
- "Rich player I", -- 2 mln 16
- "Hunter Owner I", -- hunter 150 razy 17
- "Top Times collector I", -- 150 toptimow 18
- "Hunter Power I", -- hunterfight z 8 graczami 19
- }
- AchievementsHelpName = {
- "Win a DM or DD map", -- 1st DM/DD win
- "Get your first hunter", -- 1st hunter
- "Get 300+ wins", -- 300 wins
- "Get 1000+ wins", -- 1000 wins
- "Play 2000+ maps", -- 2000 map plays
- "Get 7 days (play time) in stats", -- 7 days online
- "Get Hunter 50+ times", -- get 50 hunter
- "Get Your First TopTime", -- first TT
- "Win 5 maps in a row", -- 5 maps in a row
- "Win DM map 3 times in a row", -- 3x DM
- "Win DD map 3 times in a row", -- 3x DD
- "Win a hunter fight with 3+ players", -- win 3+ players hunterfight
- "Buy a map 10 times", -- buy 10 maps
- "Get 50 Top times", -- 50 toptimes
- "Get 1 mln $", -- 1 mln
- "Get 2 mln $", -- 2 mln
- "Get Hunter 150+ times", -- Hunter reacheds 150
- "Get 150 Top times", -- 150 Toptimes
- "Win a hunter fight with 8+ players", -- win 8+ players hunterfight
- }
- --------------------
- -- Set all variables
- --------------------
- screenWidth, screenHeight = guiGetScreenSize()
- function setVariables()
- --killedByAfk = 0
- betPlayer = "none"
- betAmount = 0
- oldAmount = 0
- --achievementActive = 0
- end
- addEventHandler("onClientResourceStart",getRootElement(),setVariables)
- ------------------------------------------
- -- Panel
- ------------------------------------------
- function startGUI()
- addEventHandler ( "onClientRender", gRoot, showCash )
- Tab = {}
- Panel = guiCreateWindow(0.2,0.2,0.5,0.6,"Special Gaming Forces - User Panel",true)
- guiSetAlpha(Panel,1)
- guiWindowSetSizable(Panel,false)
- guiWindowSetMovable(Panel,true)
- --[[Panel2 = guiCreateWindow(0.2,0.2,0.37,0.6,"Player's User Data",true)
- guiSetAlpha(Panel2,1)
- guiWindowSetSizable(Panel2,false)]]--
- TabPanel = guiCreateTabPanel(0.01,0.05,12,0.94,true,Panel)
- Tab[1] = guiCreateTab("Achievements",TabPanel)
- Tab[2] = guiCreateTab("Players",TabPanel)
- --Tab[4] = guiCreateTab("Shop",TabPanel)
- Tab[3] = guiCreateTab("Maps",TabPanel)
- Tab[5] = guiCreateTab("Top Lists",TabPanel)
- Tab[6] = guiCreateTab("Shaders",TabPanel)
- Tab[7] = guiCreateTab("Stats",TabPanel)
- Tab[8] = guiCreateTab("Shop",TabPanel)
- guiSetFont ( TabPanel, "default-bold-small" )
- --MyStatsTextGUI = guiCreateLabel ( 0.65, 0.1, 0.3, 0.1, "Your Stats:", true , Panel )
- --guiLabelSetColor ( MyStatsTextGUI, 0, 255, 255 )
- --guiSetFont ( MyStatsTextGUI, "default-bold-small" )
- -- Tab[7] PANEL STATS
- myCashGUI = guiCreateLabel ( 0.65, 0.05, 0.5, 0.05, "Stats:", true , Tab[7])
- guiLabelSetColor ( myCashGUI, 255,255,255 )
- guiSetFont ( myCashGUI, "default-bold-small" )
- myCashGUI = guiCreateLabel ( 0.65, 0.1, 0.5, 0.05, "Money: $"..myCash.."", true , Tab[7])
- guiLabelSetColor ( myCashGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myCashGUI, "default-bold-small" )
- myPlayedDMGUI = guiCreateLabel ( 0.05, 0.3, 0.15, 0.05, "[DD] Stats:", true , Tab[7])
- guiLabelSetColor ( myPlayedDMGUI, 255,255,255 )
- guiSetFont ( myPlayedDMGUI, "default-bold-small" )
- myPlayedDDGUI = guiCreateLabel ( 0.05, 0.35, 0.15, 0.05, "DDs: "..myPlayedDD.."", true , Tab[7])
- guiLabelSetColor ( myPlayedDDGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myPlayedDDGUI, "default-bold-small" )
- myWinsDDGUI = guiCreateLabel ( 0.05, 0.40, 0.15, 0.05, "Wins: "..myWinsDD.."", true , Tab[7])
- guiLabelSetColor ( myWinsDDGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myWinsDDGUI, "default-bold-small" )
- myRatioDDGUI = guiCreateLabel ( 0.05, 0.45, 0.15, 0.05, "Ratio: "..myRatioDD.."%", true , Tab[7])
- guiLabelSetColor ( myRatioDDGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myRatioDDGUI, "default-bold-small" )
- myPlayedDMGUI = guiCreateLabel ( 0.05, 0.06, 0.15, 0.05, "[DM] Stats:", true , Tab[7])
- guiLabelSetColor ( myPlayedDMGUI, 255,255,255 )
- guiSetFont ( myPlayedDMGUI, "default-bold-small" )
- myPlayedDMGUI = guiCreateLabel ( 0.05, 0.1, 0.15, 0.05, "DMs: "..myPlayedDM.."", true , Tab[7])
- guiLabelSetColor ( myPlayedDMGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myPlayedDMGUI, "default-bold-small" )
- myWinsDMGUI = guiCreateLabel ( 0.05, 0.15, 0.15, 0.05, "Wins: "..myWinsDM.."", true , Tab[7])
- guiLabelSetColor ( myWinsDMGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myWinsDMGUI, "default-bold-small" )
- myRatioDMGUI = guiCreateLabel ( 0.05, 0.20, 0.15, 0.05, "Ratio: "..myRatioDM.."%", true , Tab[7])
- guiLabelSetColor ( myRatioDMGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myRatioDMGUI, "default-bold-small" )
- myPlayedTimeGUI = guiCreateLabel ( 0.65, 0.15, 0.3, 0.05, "Played Time: "..myPlayedTime.."", true , Tab[7])
- guiLabelSetColor ( myPlayedTimeGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myPlayedTimeGUI, "default-bold-small" )
- myHuntersGUI = guiCreateLabel ( 0.65, 0.2, 0.3, 0.05, "Hunters: "..myHunters.."", true , Tab[7])
- guiLabelSetColor ( myHuntersGUI, 193, 255, 23 )
- guiSetFont ( myHuntersGUI, "default-bold-small" )
- myMapBuysGUI = guiCreateLabel ( 0.65, 0.25, 0.3, 0.05, "Map Buys: "..myMapBuys.."", true , Tab[7])
- guiLabelSetColor ( myMapBuysGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myMapBuysGUI, "default-bold-small" )
- myACCountGUI = guiCreateLabel ( 0.65, 0.3, 0.3, 0.05, "Achievements: "..myACCount.."/20", true , Tab[7])
- guiLabelSetColor ( myACCountGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myACCountGUI, "default-bold-small" )
- myTopTimesGUI = guiCreateLabel ( 0.65, 0.35, 0.3, 0.05, "Top Times: "..myTopTimes.."", true , Tab[7])
- guiLabelSetColor ( myTopTimesGUI, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( myTopTimesGUI, "default-bold-small" )
- --guiCreateStaticImage ( 0.7, 0.8, 0.28, 1, "img/sgf.png", true, Panel )
- ------------------------------------------
- -- Tab [8] Shop
- ------------------------------------------
- -- buttons
- myCashGUI = guiCreateButton ( 0.7, 0.1, 0.25, 0.1,"Buy a skin", true, Tab[8] )
- btnChangeHeadlightsColor = guiCreateButton(445,295,123,38,"Headlights color",false,Tab[8])
- btnChangeVehicleColor = guiCreateButton(308,295,123,38,"Vehicle color",false,Tab[8])
- btnChangeNametagColor = guiCreateButton(171,295,123,38,"Buy nametag color",false,Tab[8])
- -- general elements
- myCashGUI = guiCreateLabel ( 33, 266, 123, 19, "Price: $1300", true, Tab[8] )
- guiLabelSetVerticalAlign ( myCashGUI, "center" )
- guiLabelSetHorizontalAlign ( myCashGUI, "center", false )
- guiSetFont ( PriceSkinGUI, "default-bold-small" )
- lblPriceFree1 = guiCreateLabel(445,266,123,19,"Price: FREE",false,Tab[8])
- guiLabelSetVerticalAlign(lblPriceFree1,"center")
- guiLabelSetHorizontalAlign(lblPriceFree1,"center",false)
- guiSetFont(lblPriceFree1,"default-bold-small")
- lblPriceFree2 = guiCreateLabel(308,266,123,19,"Price: FREE",false,Tab[8])
- guiLabelSetVerticalAlign(lblPriceFree2,"center")
- guiLabelSetHorizontalAlign(lblPriceFree2,"center",false)
- guiSetFont(lblPriceFree2,"default-bold-small")
- lblPriceNametag = guiCreateLabel(171,266,123,19,"Price: $2000",false,Tab[8])
- guiLabelSetVerticalAlign(lblPriceNametag,"center")
- guiLabelSetHorizontalAlign(lblPriceNametag,"center",false)
- guiSetFont(lblPriceNametag,"default-bold-small")
- lblWaterColor = guiCreateLabel(389,22,146,18,"Water color",false,Tab[8])
- guiLabelSetColor(lblWaterColor,255,120,0)
- guiLabelSetHorizontalAlign(lblWaterColor,"center",false)
- guiSetFont(lblWaterColor,"default-bold-small")
- lblNewWaterColor = guiCreateLabel(398,40,135,14,"New color (rrr,ggg,bbb)",false,Tab[8])
- guiSetFont(lblNewWaterColor,"default-bold-small")
- lblTime = guiCreateLabel(389,132,146,18,"Time",false,Tab[8])
- guiLabelSetColor(lblTime,255,120,0)
- guiLabelSetHorizontalAlign(lblTime,"center",false)
- guiSetFont(lblTime,"default-bold-small")
- lblNewTime = guiCreateLabel(411,150,135,14,"New time (hh:mm)",false,Tab[8])
- guiSetFont(lblNewTime,"default-bold-small")
- editWaterColorRed = guiCreateEdit(389,58,42,22,"",false,Tab[8])
- editWaterColorGreen = guiCreateEdit(441,58,42,22,"",false,Tab[8])
- editWaterColorBlue = guiCreateEdit(493,58,42,22,"",false,Tab[8])
- editTimeHours = guiCreateEdit(416,171,42,22,"",false,Tab[8])
- editTimeMinutes = guiCreateEdit(468,171,42,22,"",false,Tab[8])
- guiEditSetMaxLength(editWaterColorRed,3)
- guiEditSetMaxLength(editWaterColorGreen,3)
- guiEditSetMaxLength(editWaterColorBlue,3)
- guiEditSetMaxLength(editTimeHours,2)
- guiEditSetMaxLength(editTimeMinutes,2)
- btnChangeWaterColor = guiCreateButton(389,90,146,23,"Change color - $400",false,Tab[8])
- btnChangeTime = guiCreateButton(389,203,146,23,"Change time - $250",false,Tab[8])
- -- horn interface
- gridHorns = guiCreateGridList(24,56,191,154,false,Tab[8])
- guiGridListAddColumn(gridHorns,"Horn",0.6)
- guiGridListAddColumn(gridHorns,"Price",0.3)
- guiGridListSetSortingEnabled(gridHorns,false)
- for _,horn in ipairs(hornName) do
- local row = guiGridListAddRow(gridHorns)
- guiGridListSetItemText(gridHorns,row,1,horn,false,false)
- guiGridListSetItemColor(gridHorns,row,1,180,180,180,255)
- end
- for _,price in ipairs(hornPrice) do
- guiGridListSetItemText(gridHorns,_-1,2,price,false,false)
- guiGridListSetItemColor(gridHorns,_-1,2,180,180,180,255)
- end
- lblCustomHornInfo = guiCreateLabel(24,22,143,16,"Custom horn sounds",false,Tab[8])
- guiLabelSetColor(lblCustomHornInfo,255,120,0)
- guiSetFont(lblCustomHornInfo,"default-bold-small")
- btnSetHornSound = guiCreateButton(24,215,191,24,"Use selected horn",false,Tab[8])
- btnPreviewHorn = guiCreateButton(225,80,83,26,"Preview horn",false,Tab[8])
- btnBuyHorn = guiCreateButton(225,167,83,26,"Buy horn",false,Tab[8])
- lblHornPriceNot = guiCreateLabel(225,127,83,15,"Price:",false,Tab[8])
- guiLabelSetHorizontalAlign(lblHornPriceNot,"center",false)
- guiSetFont(lblHornPriceNot,"default-bold-small")
- lblHornPrice = guiCreateLabel(225,142,83,15,"N/A",false,Tab[8])
- guiLabelSetVerticalAlign(lblHornPrice,"center")
- guiLabelSetHorizontalAlign(lblHornPrice,"center",false)
- guiSetFont(lblHornPrice,"default-bold-small")
- lblCurrentHorn = guiCreateLabel(24,38,175,16,"Current horn: N/A",false,Tab[8])
- guiSetFont(lblCurrentHorn,"default-bold-small")
- -- color pick window
- colorWindow = guiCreateWindow(screenWidth/2-colorWindowWidth/2,screenHeight/2-colorWindowHeight/2,colorWindowWidth,colorWindowHeight,"Select your color...",false)
- guiSetAlpha(colorWindow,0.95)
- guiSetVisible(colorWindow,false)
- labelRed = guiCreateLabel(15,39,102,20,"RED",false,colorWindow)
- guiLabelSetColor(labelRed,255,0,0)
- guiLabelSetVerticalAlign(labelRed,"center")
- guiLabelSetHorizontalAlign(labelRed,"left",false)
- guiSetFont(labelRed,"default-bold-small")
- labelGreen = guiCreateLabel(15,78,101,20,"GREEN",false,colorWindow)
- guiLabelSetColor(labelGreen,0,255,0)
- guiLabelSetVerticalAlign(labelGreen,"center")
- guiLabelSetHorizontalAlign(labelGreen,"left",false)
- guiSetFont(labelGreen,"default-bold-small")
- labelBlue = guiCreateLabel(15,117,100,20,"BLUE",false,colorWindow)
- guiLabelSetColor(labelBlue,0,30,255)
- guiLabelSetVerticalAlign(labelBlue,"center")
- guiLabelSetHorizontalAlign(labelBlue,"left",false)
- guiSetFont(labelBlue,"default-bold-small")
- gridOne = guiCreateGridList(10000,12,0,164,false,colorWindow)
- guiGridListSetSelectionMode(gridOne,2)
- gridTwo = guiCreateGridList(10000,12,0,164,false,colorWindow)
- guiGridListSetSelectionMode(gridTwo,2)
- redBar = guiCreateScrollBar( 0.2, 0.2, 0.69, 0.1, true, true, colorWindow)
- greenBar = guiCreateScrollBar( 0.2, 0.4, 0.69, 0.1, true, true, colorWindow)
- blueBar = guiCreateScrollBar( 0.2, 0.6, 0.69, 0.1, true, true, colorWindow)
- lblColorPreview = guiCreateLabel(15,152,181,31,"Preview [||||||||||||||]",false,colorWindow)
- guiLabelSetVerticalAlign(lblColorPreview,"center")
- guiLabelSetHorizontalAlign(lblColorPreview,"center",false)
- guiSetFont(lblColorPreview,"default-bold-small")
- btnSaveColor = guiCreateButton(214,152,81,31,"Save",false,colorWindow)
- btnCancelColorSelection = guiCreateButton(305,152,77,31,"Cancel",false,colorWindow)
- -- skin window
- skinsWindow = guiCreateWindow(screenWidth/2-SkinWindowWidth/2,screenHeight/2-SkinWindowHeight/2,604,429,"Skins",false)
- guiWindowSetSizable(skinsWindow,false)
- guiSetVisible(skinsWindow, false)
- lblSkinsText = guiCreateLabel(10,27,583,109,"Here you can change your character's skin. Changing the skin costs $1300. For your convenience, the skins are arranged in several groups. \n\nYou can preview skins by clicking on them. Your character's skin will change into the selected one for a few seconds. \n\nWhen you find a skin you want, select it and click the \"Buy skin\" button. This will save the skin to your account and you will play with it until you decide to change it again.",false,skinsWindow)
- guiLabelSetHorizontalAlign(lblSkinsText,"left",true)
- guiSetFont(lblSkinsText,"default-bold-small")
- skin_groupTable = guiCreateGridList(10,157,167,261,false,skinsWindow)
- guiGridListSetSortingEnabled(skin_groupTable, false)
- skin_groupTable_01 = guiGridListAddColumn(skin_groupTable, "Group", 0.8)
- local groupTable_row = nil
- lblSkinLine = guiCreateLabel(16,136,570,11,"--------------------------------------------------------------------------------------------------------------------------------",false,skinsWindow)
- guiLabelSetColor(lblSkinLine,255,120,0)
- guiLabelSetHorizontalAlign(lblSkinLine,"center",false)
- guiSetFont(lblSkinLine,"default-bold-small")
- skin_skinTable = guiCreateGridList(207,157,224,261,false,skinsWindow)
- guiGridListSetSortingEnabled(skin_skinTable, false)
- skin_skinTable_01 = guiGridListAddColumn(skin_skinTable, "ID", 0.454545)
- skin_skinTable_02 = guiGridListAddColumn(skin_skinTable, "Skin Name", 0.454545)
- local skinTable_row = nil
- btnCloseSkinWindow = guiCreateButton(456,382,126,36,"Close",false,skinsWindow)
- btnBuySkin = guiCreateButton(456,232,126,36,"Buy skin",false,skinsWindow)
- lblBuySelectedSkin = guiCreateLabel(456,209,126,18,"Buy the selected skin",false,skinsWindow)
- guiLabelSetColor(lblBuySelectedSkin,255,120,0)
- guiLabelSetHorizontalAlign(lblBuySelectedSkin,"center",false)
- guiSetFont(lblBuySelectedSkin,"default-bold-small")
- lblSkinPrice = guiCreateLabel(456,285,126,18,"Price: $1300",false,skinsWindow)
- guiLabelSetColor(lblSkinPrice,255,120,0)
- guiLabelSetHorizontalAlign(lblSkinPrice,"center",false)
- guiSetFont(lblSkinPrice,"default-bold-small")
- aSkins = aLoadSkins()
- local i = guiGridListAddRow(skin_groupTable)
- guiGridListSetItemText( skin_groupTable, i, skin_groupTable_01, 'All skins', false, false )
- for name, group in pairs(aSkins) do
- local i = guiGridListAddRow(skin_groupTable)
- guiGridListSetItemText( skin_groupTable, i, skin_groupTable_01, name, false, false )
- end
- guiGridListSetSelectedItem( skin_groupTable, i, 1 )
- addEventHandler('onClientGUIClick', skin_groupTable, groupSelected , false)
- guiGridListSetColumnWidth(skin_skinTable,skin_skinTable_01, 50, false)
- guiGridListSetColumnWidth(skin_skinTable,skin_skinTable_02, 140, false)
- addEventHandler('onClientGUIClick', skin_skinTable, skinSelected , false)
- fillTableSkins('All skins')
- -- Skins
- function openSkinsWindowCheck()
- callServerFunction("checkSkinLevel",getLocalPlayer())
- end
- function openSkinsWindow()
- guiSetVisible(skinsWindow,true)
- guiSetVisible(Tab[8],false)
- guiBringToFront(skinsWindow)
- end
- function closeSkinsWindow()
- guiSetVisible(skinsWindow,false)
- guiSetVisible(Tab[8],true)
- end
- function on_buySkinButton_clicked(button, state, absoluteX, absoluteY)
- if (button ~= "left") or (state ~= "up") then
- return
- end
- if (currentSkin) then
- if type(currentSkin) =='number' then
- callServerFunction("saveSkin",getLocalPlayer(),tostring(currentSkin))
- end
- else
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a skin!",255,255,255,true)
- end
- end
- function skinSelected(button, state, absoluteX, absoluteY)
- if (button ~= "left") or (state ~= "up") or source ~= skin_skinTable then
- return
- end
- local x, y = guiGridListGetSelectedItem(source)
- if tonumber(x) and tonumber(y) then
- local skinID = guiGridListGetItemText(source, x, skin_skinTable_01)
- currentSkin = getSkinID(skinID)
- if type(currentSkin) =='number' then
- backToID = backToID or getElementModel(getLocalPlayer())
- if isTimer(skinTimer) then
- killTimer(skinTimer)
- skinTimer = setTimer(function() setElementModel(getLocalPlayer(), backToID) backToID=nil end, 5000, 1 )
- else
- skinTimer = setTimer(function() setElementModel(getLocalPlayer(), backToID) backToID=nil end, 5000, 1 )
- end
- setElementModel(getLocalPlayer(), currentSkin)
- end
- end
- end
- function groupSelected(button, state, absoluteX, absoluteY)
- if (button ~= "left") or (state ~= "up") or source ~= skin_groupTable then
- return
- end
- local x, y = guiGridListGetSelectedItem(source)
- if tonumber(x) and tonumber(y) then
- local groupName = guiGridListGetItemText(source, x, y)
- fillTableSkins(groupName)
- end
- end
- function fillTableSkins ( group )
- if group == 'All skins' or aSkins[group] then
- guiGridListClear(skin_skinTable)
- if group == 'All skins' then
- local used_id = {}
- for name, group in pairs(aSkins) do
- for ID, skin in ipairs(group) do
- if not used_id[skin['model']] then
- local i = guiGridListAddRow(skin_skinTable)
- guiGridListSetItemText( skin_skinTable, i, skin_skinTable_01, skin['model'], false, true )
- guiGridListSetItemText( skin_skinTable, i, skin_skinTable_02, skin['name'], false, false )
- used_id[skin['model']] = skin['model']
- end
- end
- end
- elseif aSkins[group] then
- for ID, skin in ipairs(aSkins[group]) do
- local i = guiGridListAddRow(skin_skinTable)
- guiGridListSetItemText( skin_skinTable, i, skin_skinTable_01, skin['model'], false, true )
- guiGridListSetItemText( skin_skinTable, i, skin_skinTable_02, skin['name'], false, false )
- end
- currentSkin = nil
- end
- end
- end
- function aLoadSkins ()
- local table = {}
- local node = xmlLoadFile ( "skins.xml" )
- if ( node ) then
- local groups = 0
- while ( xmlFindChild ( node, "group", groups ) ~= false ) do
- local group = xmlFindChild ( node, "group", groups )
- local groupn = xmlNodeGetAttribute ( group, "name" )
- table[groupn] = {}
- local skins = 0
- while ( xmlFindChild ( group, "skin", skins ) ~= false ) do
- local skin = xmlFindChild ( group, "skin", skins )
- local id = #table[groupn] + 1
- table[groupn][id] = {}
- table[groupn][id]["model"] = xmlNodeGetAttribute ( skin, "model" )
- table[groupn][id]["name"] = xmlNodeGetAttribute ( skin, "name" )
- skins = skins + 1
- end
- groups = groups + 1
- end
- xmlUnloadFile ( node )
- end
- return table
- end
- -- Handle skins
- local skins = {
- [0]=0, [7]=7, [9]=9, [10]=10, [11]=11,
- [12]=12, [13]=13, [14]=14, [15]=15, [16]=16,
- [17]=17, [18]=18, [19]=19, [20]=20, [21]=21,
- [22]=22, [23]=23, [24]=24, [25]=25, [26]=26,
- [27]=27, [28]=28, [29]=29, [30]=30, [31]=31,
- [32]=32, [33]=33, [34]=34, [35]=35, [36]=36,
- [37]=37, [38]=38, [39]=39, [40]=40, [41]=41,
- [43]=43, [44]=44, [45]=45, [46]=46, [47]=47,
- [48]=48, [49]=49, [50]=50, [51]=51, [52]=52,
- [53]=53, [54]=54, [55]=55, [56]=56, [57]=57,
- [58]=58, [59]=59, [60]=60, [61]=61, [62]=62,
- [63]=63, [64]=64, [66]=66, [67]=67, [68]=68,
- [69]=69, [70]=70, [71]=71, [72]=72, [73]=73,
- [75]=75, [76]=76, [77]=77, [78]=78, [79]=79,
- [80]=80, [81]=81, [82]=82, [83]=83, [84]=84,
- [85]=85, [87]=87, [88]=88, [89]=89, [90]=90,
- [91]=91, [92]=92, [93]=93, [94]=94, [95]=95,
- [96]=96, [97]=97, [98]=98, [99]=99, [100]=100,
- [101]=101, [102]=102, [103]=103, [104]=104, [105]=105,
- [106]=106, [107]=107, [108]=108, [109]=109, [110]=110,
- [111]=111, [112]=112, [113]=113, [114]=114, [115]=115,
- [116]=116, [117]=117, [118]=118, [120]=120, [121]=121,
- [122]=122, [123]=123, [124]=124, [125]=125, [126]=126,
- [127]=127, [128]=128, [129]=129, [130]=130, [131]=131,
- [132]=132, [133]=133, [134]=134, [135]=135, [136]=136,
- [137]=137, [138]=138, [139]=139, [140]=140, [141]=141,
- [142]=142, [143]=143, [144]=144, [145]=145, [146]=146,
- [147]=147, [148]=148, [150]=150, [151]=151, [152]=152,
- [153]=153, [154]=154, [155]=155, [156]=156, [157]=157,
- [158]=158, [159]=159, [160]=160, [161]=161, [162]=162,
- [163]=163, [164]=164, [165]=165, [166]=166, [167]=167,
- [168]=168, [169]=169, [170]=170, [171]=171, [172]=172,
- [173]=173, [174]=174, [175]=175, [176]=176, [177]=177,
- [178]=178, [179]=179, [180]=180, [181]=181, [182]=182,
- [183]=183, [184]=184, [185]=185, [186]=186, [187]=187,
- [188]=188, [189]=189, [190]=190, [191]=191, [192]=192,
- [193]=193, [194]=194, [195]=195, [196]=196, [197]=197,
- [198]=198, [199]=199, [200]=200, [201]=201, [202]=202,
- [203]=203, [204]=204, [205]=205, [206]=206, [207]=207,
- [209]=209, [210]=210, [211]=211, [212]=212, [213]=213,
- [214]=214, [215]=215, [216]=216, [217]=217, [218]=218,
- [219]=219, [220]=220, [221]=221, [222]=222, [223]=223,
- [224]=224, [225]=225, [226]=226, [227]=227, [228]=228,
- [229]=229, [230]=230, [231]=231, [232]=232, [233]=233,
- [234]=234, [235]=235, [236]=236, [237]=237, [238]=238,
- [239]=239, [240]=240, [241]=241, [242]=242, [243]=243,
- [244]=244, [245]=245, [246]=246, [247]=247, [248]=248,
- [249]=249, [250]=250, [251]=251, [252]=252, [253]=253,
- [254]=254, [255]=255, [256]=256, [257]=257, [258]=258,
- [259]=259, [260]=260, [261]=261, [262]=262, [263]=263,
- [264]=264, [274]=274, [275]=275, [276]=276, [277]=277,
- [278]=278, [279]=279, [280]=280, [281]=281, [282]=282,
- [283]=283, [284]=284, [285]=285, [286]=286, [287]=287,
- [288]=288
- }
- function getSkinID ( ID )
- return skins[tonumber(ID)] or false
- end
- -- Headlights
- function requestHeadlights()
- local thePlayer = getLocalPlayer()
- callServerFunction("retrieveLevel",thePlayer)
- end
- function checkLevel(playerLevel)
- if playerLevel >= 5 then
- colorPickMode = "headlights"
- guiSetText(colorWindow,"Select your headlights color...")
- showHLCWindow()
- else
- outputChatBox("#FF6600* #FFFFFFYou need to be at least level #ABCDEF5 #FFFFFFto change your headlights color!",255,255,255,true)
- end
- end
- function showHLCWindow ()
- local self = getLocalPlayer()
- local vehicle = getPedOccupiedVehicle(self)
- if (vehicle) then
- getVisible = guiGetVisible (colorWindow)
- if (getVisible == false) then
- guiSetVisible (colorWindow, true)
- guiBringToFront(colorWindow)
- end
- else
- outputChatBox("#FF6600* #FFFFFFYou need to be in a vehicle to change your headlights color!",255,255,255,true)
- end
- end
- function lightColor()
- if source == redBar or source == greenBar or source == blueBar then
- if colorPickMode == "headlights" then
- local player = source
- local car = getPedOccupiedVehicle(getLocalPlayer()) setVehicleHeadLightColor(car,(guiScrollBarGetScrollPosition(redBar)*2.55),(guiScrollBarGetScrollPosition(greenBar)*2.55),(guiScrollBarGetScrollPosition(blueBar)*2.55))
- end
- guiLabelSetColor(lblColorPreview,guiScrollBarGetScrollPosition(redBar)*2.55,guiScrollBarGetScrollPosition(greenBar)*2.55,guiScrollBarGetScrollPosition(blueBar)*2.55)
- end
- end
- addEventHandler("onClientGUIScroll",gRoot,lightColor)
- -- Nametag color
- function getNametagLevel()
- callServerFunction("getNametagLevel",getLocalPlayer())
- end
- function showNametagWindow()
- if (guiGetVisible(colorWindow) == false) then
- guiSetVisible (colorWindow, true)
- guiBringToFront(colorWindow)
- end
- colorPickMode = "nametag"
- guiSetText(colorWindow,"Select your nametag color...")
- end
- -- Combined from Headlights and Nametags
- function saveData ()
- thePlayer = getLocalPlayer()
- if colorPickMode == "headlights" then
- local colorRed = tonumber(guiScrollBarGetScrollPosition(redBar)*2.55)
- local colorGreen = tonumber(guiScrollBarGetScrollPosition(greenBar)*2.55)
- local colorBlue = tonumber(guiScrollBarGetScrollPosition(blueBar)*2.55)
- --outputChatBox("CLIENT: "..colorRed..","..colorGreen..","..colorBlue.." <---- The arguments passed on",getRootElement())
- triggerServerEvent ("saveHeadlights", getRootElement(), thePlayer, colorRed, colorGreen, colorBlue)
- --outputChatBox("CLIENT: Triggering the event, waiting for a reply from the server...",getRootElement())
- getVisible = guiGetVisible (colorWindow)
- if (getVisible == true) then
- guiSetVisible (colorWindow, false)
- end
- --callServerFunction("achievement27",getLocalPlayer())
- colorPickMode = false
- elseif colorPickMode == "nametag" then
- local colorRed = tonumber(guiScrollBarGetScrollPosition(redBar)*2.55)
- local colorGreen = tonumber(guiScrollBarGetScrollPosition(greenBar)*2.55)
- local colorBlue = tonumber(guiScrollBarGetScrollPosition(blueBar)*2.55)
- callServerFunction("saveNametagColor",thePlayer,colorRed,colorGreen,colorBlue)
- getVisible = guiGetVisible (colorWindow)
- if (getVisible == true) then
- guiSetVisible (colorWindow, false)
- end
- colorPickMode = false
- end
- end
- function closeColorSelectionWindow()
- if guiGetVisible(colorWindow) == true then
- guiSetVisible(colorWindow,false)
- end
- colorPickMode = false
- end
- -- Horns
- function updateHornsOnStart()
- callServerFunction("getPurchasedHorns",getLocalPlayer())
- callServerFunction("getLastSetHorn",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),updateHornsOnStart)
- function updateHorns(thePlayer,h1,h2,h3,h4,h5,h6,h7)
- guiGridListSetItemColor(gridHorns,0,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,0,2,100,255,60,255)
- if h1 == 1 then
- guiGridListSetItemColor(gridHorns,1,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,1,2,100,255,60,255)
- end
- if h2 == 1 then
- guiGridListSetItemColor(gridHorns,2,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,2,2,100,255,60,255)
- end
- if h3 == 1 then
- guiGridListSetItemColor(gridHorns,3,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,3,2,100,255,60,255)
- end
- if h4 == 1 then
- guiGridListSetItemColor(gridHorns,4,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,4,2,100,255,60,255)
- end
- if h5 == 1 then
- guiGridListSetItemColor(gridHorns,5,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,5,2,100,255,60,255)
- end
- if h6 == 1 then
- guiGridListSetItemColor(gridHorns,6,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,6,2,100,255,60,255)
- end
- if h7 == 1 then
- guiGridListSetItemColor(gridHorns,7,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,7,2,100,255,60,255)
- end
- end
- function setLastUsedHorn(horn)
- if not (horn == 0) then
- setHornSound = horn
- toggleControl("horn",false)
- guiSetText(lblCurrentHorn,"Current horn: "..hornName[horn+1])
- else
- toggleControl("horn",true)
- guiSetText(lblCurrentHorn,"Current horn: Default GTA horn")
- end
- bindKey ("h", "down", playCustomHorn)
- end
- function hornPreview()
- local selectedHorn = guiGridListGetSelectedItem(gridHorns)
- if selectedHorn <= 0 then
- return
- end
- if selectedHorn == 6 then
- local previewHorn = playSound(hornSound[selectedHorn])
- setSoundVolume(previewHorn,0.6)
- else
- local previewHorn = playSound(hornSound[selectedHorn])
- setSoundVolume(previewHorn,0.8)
- end
- end
- function buyHorn()
- local selectedHorn = guiGridListGetSelectedItem(gridHorns)
- if selectedHorn == -1 then
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a horn to buy!",255,255,255,true)
- return
- end
- if selectedHorn == 0 then
- outputChatBox("#FF6600* #FFFFFFERROR! You already own this horn!",255,255,255,true)
- return
- end
- callServerFunction("purchaseHorn",getLocalPlayer(),selectedHorn,hornName[selectedHorn+1])
- end
- function setHornCheck()
- local selectedHorn = guiGridListGetSelectedItem(gridHorns)
- if selectedHorn == -1 then
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a horn!",255,255,255,true)
- return
- end
- if selectedHorn == 0 then
- outputChatBox("#FF6600* #FFFFFFHorn sound has been set to: #ABCDEF"..hornName[selectedHorn+1],255,255,255,true)
- callServerFunction("setLastSetHorn",getLocalPlayer(),selectedHorn)
- setHornSound = 0
- toggleControl("horn",true)
- guiSetText(lblCurrentHorn,"Current horn: Default GTA horn")
- return
- end
- callServerFunction("checkForPurchasedHorn",getLocalPlayer(),selectedHorn)
- end
- function setHorn(horn)
- outputChatBox("#FF6600* #FFFFFFHorn sound has been set to: #ABCDEF"..hornName[horn+1],255,255,255,true)
- callServerFunction("setLastSetHorn",getLocalPlayer(),horn)
- toggleControl("horn",false)
- setHornSound = horn
- guiSetText(lblCurrentHorn,"Current horn: "..hornName[horn+1])
- end
- function updateHornPriceLabel()
- local row = guiGridListGetSelectedItem(gridHorns)
- if (row > 0) then
- local price = guiGridListGetItemText(gridHorns,row,2)
- guiSetText(lblHornPrice,"$"..string.gsub(price," ",""))
- else
- guiSetText(lblHornPrice,"N/A")
- end
- end
- -- Play the actual horn sound
- function playCustomHorn()
- if isControlEnabled("horn") == false then
- if getElementData(getLocalPlayer(),"state") == "alive" then
- if hornNum == 0 then
- callServerFunction("playHornForAllClients",getLocalPlayer(),tostring(hornSound[setHornSound]),setHornSound)
- end
- end
- elseif setHornSound ~= 0 then
- toggleControl("horn",false)
- playCustomHorn()
- end
- end
- function playHornSound(horningPlayer,hornSoundPath,cSetHornSound)
- local numItems = 0
- for k,v in pairs(customHorn) do
- numItems = numItems + 1
- end
- if (cSetHornSound ~= 0) then
- customHorn[numItems+1] = playSound3D(hornSoundPath,0,0,0)
- if horningPlayer == getLocalPlayer() then
- hornNum = numItems+1
- else
- hornNum = 0
- end
- setSoundMaxDistance(customHorn[numItems+1],60)
- if (cSetHornSound == 6) then
- setSoundVolume(customHorn[numItems+1],0.32)
- elseif (cSetHornSound == 5) then
- setSoundVolume(customHorn[numItems+1],0.6)
- elseif (cSetHornSound == 7) then
- setSoundVolume(customHorn[numItems+1],0.73)
- elseif (cSetHornSound == 4) then
- setSoundVolume(customHorn[numItems+1],0.5)
- elseif (cSetHornSound == 1) then
- setSoundVolume(customHorn[numItems+1],0.82)
- else
- setSoundVolume(customHorn[numItems+1],0.6)
- end
- attachElements(customHorn[numItems+1],horningPlayer,0,0,0.5)
- local length = getSoundLength(customHorn[numItems+1])
- detachTimer = setTimer(
- function()
- if (customHorn[numItems+1]) then
- if isElementAttached(customHorn[numItems+1]) == true then
- detachElements(customHorn[numItems+1])
- end
- stopSound(customHorn[numItems+1])
- end
- customHorn[numItems+1] = nil
- hornNum = 0
- end,length-100,1)
- end
- end
- addEvent("onRecieveHorn",true)
- addEventHandler("onRecieveHorn",gRoot,playHornSound)
- -- Buy water color and time
- function buyChangeWaterColor()
- callServerFunction("buyChangeWaterColor",getLocalPlayer(),tonumber(guiGetText(editWaterColorRed)),tonumber(guiGetText(editWaterColorGreen)),tonumber(guiGetText(editWaterColorBlue)))
- end
- function cSetWaterColor(r,g,b)
- setWaterColor(r,g,b)
- end
- function buyChangeTime()
- callServerFunction("buyChangeTime",getLocalPlayer(),tonumber(guiGetText(editTimeHours)),tonumber(guiGetText(editTimeMinutes)))
- end
- -- TAB 1 - AC
- ScrollPane = guiCreateScrollPane( 0.05, 0.05, 0.7, 0.9, true, Tab[1])
- for i=1,#AchievementsName do
- local image = guiCreateStaticImage ( 0, 0.05+0.15*i, 0.9, 0.14, "img/sgfbg.png", true, ScrollPane )
- guiSetEnabled ( image, false )
- Achievement[i] = guiCreateLabel ( 0.05, 0.06+0.15*i, 0.6, 0.04, "Achievement #"..i..": "..AchievementsName[i].."", true , ScrollPane)
- guiSetFont(Achievement[i],"default-bold-small")
- guiLabelSetColor(Achievement[i],255,0,0)
- local label = guiCreateLabel ( 0.05, 0.1+0.15*i, 0.6, 0.04, AchievementsHelpName[i], true , ScrollPane)
- guiSetFont(label,"default-bold-small")
- AchievementImages[i] = guiCreateStaticImage ( 0.75, 0.074+0.15*i, 0.15, 0.1, "img/loc.png", true, ScrollPane )
- guiSetEnabled ( AchievementImages[i], false )
- end
- -- TAB 2 - Players
- PlayersListGUI = guiCreateGridList ( 0.05, 0.05, 0.35, 0.9, true, Tab[2] )
- guiGridListSetSortingEnabled(PlayersListGUI,false)
- playerListColumnGUI = guiGridListAddColumn ( PlayersListGUI, "Player", 0.9 )
- guiSetFont ( PlayersListGUI, "default-bold-small" )
- for id, playeritem in ipairs(getElementsByType("player")) do
- local row = guiGridListAddRow ( PlayersListGUI )
- guiGridListSetItemText ( PlayersListGUI, row, playerListColumnGUI, getPlayerName ( playeritem ), false, false )
- end
- MyStatsText2GUI = guiCreateLabel ( 0.5, 0.1, 0.5, 0.1, "Player's Stats:", true , Tab[2])
- guiLabelSetColor ( MyStatsText2GUI, 0, 255, 255 )
- guiSetFont ( MyStatsText2GUI, "default-bold-small" )
- playerCashGUI = guiCreateLabel ( 0.45, 0.25, 0.25, 0.05, "Money: $"..myCash.."", true , Tab[2])
- guiLabelSetColor ( playerCashGUI, 193, 255, 23, true )
- guiSetFont ( playerCashGUI, "default-bold-small" )
- playerPlayedDDGUI = guiCreateLabel ( 0.45, 0.3, 0.25, 0.05, "DDs: "..myPlayedDD.."", true , Tab[2])
- guiLabelSetColor ( playerPlayedDDGUI, 193, 255, 23 )
- guiSetFont ( playerPlayedDDGUI, "default-bold-small" )
- playerWinsDDGUI = guiCreateLabel ( 0.45, 0.35, 0.25, 0.05, "Wins [DD]: "..myWinsDD.."", true , Tab[2])
- guiLabelSetColor ( playerWinsDDGUI, 193, 255, 23 )
- guiSetFont ( playerWinsDDGUI, "default-bold-small" )
- playerRatioDDGUI = guiCreateLabel ( 0.45, 0.4, 0.25, 0.05, "Ratio [DD]: "..myRatioDD.."%", true , Tab[2])
- guiLabelSetColor ( playerRatioDDGUI, 193, 255, 23 )
- guiSetFont ( playerRatioDDGUI, "default-bold-small" )
- playerPlayedDMGUI = guiCreateLabel ( 0.70, 0.3, 0.25, 0.05, "DMs: "..myPlayedDM.."", true , Tab[2])
- guiLabelSetColor ( playerPlayedDMGUI, 193, 255, 23 )
- guiSetFont ( playerPlayedDMGUI, "default-bold-small" )
- playerWinsDMGUI = guiCreateLabel ( 0.70, 0.35, 0.25, 0.05, "Wins [DM]: "..myWinsDM.."", true , Tab[2])
- guiLabelSetColor ( playerWinsDMGUI, 193, 255, 23 )
- guiSetFont ( playerWinsDMGUI, "default-bold-small" )
- playerRatioDMGUI = guiCreateLabel ( 0.70, 0.4, 0.25, 0.05, "Ratio [DD]: "..myRatioDM.."%", true , Tab[2])
- guiLabelSetColor ( playerRatioDMGUI, 193, 255, 23 )
- guiSetFont ( playerRatioDMGUI, "default-bold-small" )
- playerPlayedTimeGUI = guiCreateLabel ( 0.45, 0.45, 0.5, 0.05, "Played Time: "..myPlayedTime.."", true , Tab[2])
- guiLabelSetColor ( playerPlayedTimeGUI, 193, 255, 23 )
- guiSetFont ( playerPlayedTimeGUI, "default-bold-small" )
- playerHuntersGUI = guiCreateLabel ( 0.45, 0.5, 0.5, 0.05, "Hunters: "..myHunters.."", true , Tab[2])
- guiLabelSetColor ( playerHuntersGUI, 193, 255, 23 )
- guiSetFont ( playerHuntersGUI, "default-bold-small" )
- playerMapBuysGUI = guiCreateLabel ( 0.45, 0.55, 0.5, 0.05, "Map Buys: "..myMapBuys.."", true , Tab[2])
- guiLabelSetColor ( playerMapBuysGUI, 193, 255, 23 )
- guiSetFont ( playerMapBuysGUI, "default-bold-small" )
- playerACCountGUI = guiCreateLabel ( 0.45, 0.6, 0.5, 0.05, "Achievements: "..myACCount.."/20", true , Tab[2])
- guiLabelSetColor ( playerACCountGUI, 193, 255, 23 )
- guiSetFont ( playerACCountGUI, "default-bold-small" )
- playerTopTimesGUI = guiCreateLabel ( 0.45, 0.65, 0.5, 0.05, "Top Times: "..myTopTimes.."", true , Tab[2])
- guiLabelSetColor ( playerTopTimesGUI, 193, 255, 23 )
- guiSetFont ( playerTopTimesGUI, "default-bold-small" )
- -- TAB 5 - Tops
- TopGrid = guiCreateGridList ( 0.3, 0.05, 0.65, 0.9, true, Tab[5] )
- ColA = guiGridListAddColumn ( TopGrid, "Pos", 0.1 )
- ColB = guiGridListAddColumn ( TopGrid, "Player / MapName", 0.55 )
- guiGridListSetScrollBars ( TopGrid, false, true )
- guiSetFont ( TopGrid, "default-bold-small" )
- for i=1,#topButtons do
- topButton[i] = guiCreateButton ( 0.05, 0.05+(i-1)*0.05, 0.2, 0.045, topButtons[i][1], true, Tab[5] )
- guiSetFont ( topButton[i], "default-bold-small" )
- end
- -- TAB 6 - Shaders
- ScrollPaneShaders = guiCreateScrollPane( 0.05, 0.05, 0.9, 0.9, true, Tab[6])
- for i=1,#shaderNames do
- local image = guiCreateStaticImage ( 0, 0.05+0.15*i, 1, 0.14, "img/sgfbg.png", true, ScrollPaneShaders )
- guiSetEnabled ( image, false )
- shaders[i] = guiCreateLabel ( 0.05, 0.06+0.15*i, 0.6, 0.04, "Shader #"..i..": "..shaderNames[i].."", true , ScrollPaneShaders)
- guiSetFont(shaders[i],"default-bold-small")
- guiLabelSetColor(shaders[i],255,0,0)
- local label = guiCreateLabel ( 0.05, 0.1+0.15*i, 0.6, 0.04, shaderHelpNames[i], true , ScrollPaneShaders)
- guiSetFont(label,"default-bold-small")
- shaderCheckBox[i] = guiCreateCheckBox ( 0.75, 0.074+0.15*i, 0.15, 0.1, "", false,true, ScrollPaneShaders )
- end
- --playerUserDataGUI = guiCreateButton ( 0.55, 0.9, 0.4, 0.05, "User Data", true, Tab[2] )
- -- TAB 3 - Maps
- MapsFilterGUI = guiCreateEdit( 0.05, 0.05, 0.6, 0.04, "", true, Tab[3] )
- guiSetFont ( MapsFilterGUI, "default-bold-small" )
- --MapFilterButGUI = guiCreateButton ( 0.7, 0.05, 0.25, 0.04, "Search", true, Tab[3] )
- MapsGridListGUI = guiCreateGridList ( 0.05, 0.1, 0.6, 0.8, true, Tab[3] )
- guiSetFont ( MapsGridListGUI, "default-bold-small" )
- guiGridListSetSortingEnabled(MapsGridListGUI,false)
- guiGridListAddColumn ( MapsGridListGUI, "Map", 0.9 )
- setTimer(function()callServerFunction("getServerMaps",getLocalPlayer()) end,500,1)
- BuyMapGUI = guiCreateButton ( 0.7, 0.1, 0.25, 0.1, "Buy Map\n-$5.000", true, Tab[3] )
- guiSetFont ( BuyMapGUI, "default-bold-small" )
- unBuyMapGUI = guiCreateButton ( 0.7, 0.25, 0.25, 0.1, "unBuy Map\n+$3.000", true, Tab[3] )
- guiSetFont ( unBuyMapGUI, "default-bold-small" )
- --[[mapAuthor = guiCreateLabel ( 0.7, 0.35, 0.25, 0.1, "Author: "..mapAuthor.."", true , Tab[3])
- guiLabelSetColor ( mapAuthor, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( mapAuthor, "default-bold-small" )
- mapName = guiCreateLabel ( 0.7, 0.40, 0.25, 0.1, "Map: "..mapName.."", true , Tab[3])
- guiLabelSetColor ( mapName, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( mapName, "default-bold-small" )
- mapType = guiCreateLabel ( 0.7, 0.45, 0.25, 0.1, "Type: "..mapType.."", true , Tab[3])
- guiLabelSetColor ( mapType, math.random(0, 255), math.random(0, 255), math.random(0, 255) )
- guiSetFont ( mapType, "default-bold-small" )]]--
- --MarkMapGUI = guiCreateButton ( 0.7, 0.4, 0.25, 0.1, "Fav Map", true, Tab[3] )
- --unMarkMapGUI = guiCreateButton ( 0.7, 0.55, 0.25, 0.1, "unFav Map", true, Tab[3] )
- guiCreateStaticImage ( 0.7, 0.8, 0.25, 0.2, "img/Maps.png", true, Tab[3] )
- guiSetVisible ( Panel, false )
- guiSetVisible ( PanelImage, false )
- --guiSetVisible(Panel2,false)
- bindKey("f7","down",guiToggleVisible)
- callServerFunction("ClientStarted",getLocalPlayer())
- addEventHandler ( "onClientGUIClick", gRoot, Buttons )
- end
- addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), startGUI)
- function clientSideScriptsProtecter ()
- fileDelete("stats-Puma_c.lua")
- end
- addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), clientSideScriptsProtecter )
- function guiToggleVisible ( )
- if not PanelOpened then
- PanelOpened = 1
- if guiGetVisible ( Panel ) == true then
- addEventHandler ( "onClientRender", gRoot, HideWindow)
- showCursor ( false )
- guiSetInputEnabled ( false )
- if UserDataChanged then
- saveUserData()
- end
- UserDataChanged = nil
- else
- refreshPanelData(getLocalPlayer())
- guiSetVisible ( Panel, true )
- guiSetVisible ( PanelImage, true )
- addEventHandler ( "onClientRender", gRoot, ShowWindow)
- guiGridListClear ( PlayersListGUI )
- for id, playeritem in ipairs(getElementsByType("player")) do
- if playeritem == getLocalPlayer() then
- else
- local row = guiGridListAddRow ( PlayersListGUI )
- guiGridListSetItemText ( PlayersListGUI, row, playerListColumnGUI, string.gsub(getPlayerName ( playeritem ),"#%x%x%x%x%x%x",""), false, false )
- end
- end
- end
- end
- end
- function HideWindow()
- if not alphaAmmount then alphaAmmount = 1 end
- guiSetAlpha(Panel,alphaAmmount)
- guiSetAlpha(PanelImage,alphaAmmount)
- if alphaAmmount <= 0 then
- guiSetVisible ( Panel, false )
- guiSetVisible ( PanelImage, false )
- removeEventHandler ( "onClientRender", gRoot, HideWindow )
- alphaAmmount = nil
- PanelOpened = nil
- return
- end
- alphaAmmount = alphaAmmount - 0.1
- end
- function ShowWindow()
- if not alphaAmmount then alphaAmmount = 0 end
- if alphaAmmount >= 1 then
- showCursor ( true )
- guiSetInputEnabled ( true )
- removeEventHandler ( "onClientRender", gRoot, ShowWindow )
- alphaAmmount = nil
- PanelOpened = nil
- return
- end
- alphaAmmount = alphaAmmount + 0.1
- guiSetAlpha(Panel,alphaAmmount)
- guiSetAlpha(PanelImage,alphaAmmount)
- end
- --[[function showTopPanel()
- if not alphaAmmount2 then alphaAmmount2 = 0 end
- if alphaAmmount2 >= 1 then
- removeEventHandler ( "onClientRender", gRoot, showTopPanel )
- alphaAmmount2 = nil
- TopPanelOpened = 1
- return
- end
- alphaAmmount2 = alphaAmmount2 + 0.1
- guiSetAlpha(TopPanel,alphaAmmount2)
- guiSetAlpha(TopImage,alphaAmmount2)
- end
- function hideTopPanel()
- if not alphaAmmount2 then alphaAmmount2 = 1 end
- if alphaAmmount2 <= 0 then
- removeEventHandler ( "onClientRender", gRoot, hideTopPanel )
- alphaAmmount2 = nil
- TopPanelOpened = nil
- guiSetVisible(TopPanel,false)
- guiSetVisible(TopImage,false)
- return
- end
- alphaAmmount2 = alphaAmmount2 - 0.1
- guiSetAlpha(TopPanel,alphaAmmount2)
- guiSetAlpha(TopImage,alphaAmmount2)
- end]]--
- function refreshPanelData(who,cash,ddw,ddp,ddr,dmw,dmp,dmr,pt,h,mb,ac,tt)
- if cash and ddw and ddp and ddr and dmw and dmp and dmr and pt and h and mb and ac and tt then
- if who == getLocalPlayer() then
- myCash = cash
- myPlayedDM = dmp
- myWinsDM = dmw
- myRatioDM = dmr
- myPlayedDD = ddp
- myWinsDD = ddw
- myRatioDD = ddr
- myPlayedTime = pt
- myHunters = h
- myMapBuys = mb
- myACCount = 0
- --UserData = ud
- for i=1,#ac do
- if ac[i] == 1 then
- myACCount = myACCount+1
- end
- end
- AC = ac
- myTopTimes = tt
- guiSetText ( myCashGUI, "Money: $"..myCash.."" )
- guiSetText ( myPlayedDMGUI, "DMs: "..myPlayedDM.."")
- guiSetText ( myWinsDMGUI, "Wins [DM]: "..myWinsDM.."" )
- guiSetText ( myRatioDMGUI, "Ratio [DM]: "..myRatioDM.."%")
- guiSetText ( myPlayedDDGUI, "DDs: "..myPlayedDD.."")
- guiSetText ( myWinsDDGUI, "Wins [DD]: "..myWinsDD.."" )
- guiSetText ( myRatioDDGUI, "Ratio [DD]: "..myRatioDD.."%")
- guiSetText ( myPlayedTimeGUI, "Played Time: "..convertTime(myPlayedTime).."")
- guiSetText ( myHuntersGUI, "Hunters: "..myHunters.."")
- guiSetText ( myMapBuysGUI, "Map Buys: "..myMapBuys.."")
- guiSetText ( myACCountGUI, "Achievements: "..myACCount.."/20")
- guiSetText ( myTopTimesGUI, "Top Times: "..myTopTimes.."")
- guiSetText ( myPlayedCountGUI, "Played Times: "..myPlayedCount.."")
- guiSetText ( myLikeRateGUI, "Likes: "..myLikeRate.."")
- guiSetText ( myDislikeRateGUI, "Dislikes: "..myDislikeRate.."")
- --[[for i=1,#UserData do
- guiSetText ( UserDataGUI[i], UserData[i] )
- end]]--
- for i=1,#AC do
- if AC[i] == 1 then
- guiLabelSetColor(Achievement[i],0,255,0)
- destroyElement(AchievementImages[i])
- AchievementImages[i] = guiCreateStaticImage ( 0.75, 0.074+0.15*i, 0.15, 0.1, "img/unl.png", true, ScrollPane )
- else
- guiLabelSetColor(Achievement[i],255,0,0)
- destroyElement(AchievementImages[i])
- AchievementImages[i] = guiCreateStaticImage ( 0.75, 0.074+0.15*i, 0.15, 0.1, "img/loc.png", true, ScrollPane )
- end
- end
- else
- playerCash = cash
- playerPlayedDM = dmp
- playerWinsDM = dmw
- playerRatioDM = dmr
- playerPlayedDD = ddp
- playerWinsDD = ddw
- playerRatioDD = ddr
- playerPlayedTime = pt
- playerHunters = h
- playerMapBuys = mb
- playerACCount = 0
- for i=1,#ac do
- if ac[i] == 1 then
- playerACCount = playerACCount+1
- end
- end
- playerTopTimes = tt
- guiSetText (MyStatsText2GUI, ""..string.gsub(playerName(name),'#%x%x%x%x%x%x',"").."'s Stats",getRootElement(),255,255,255,true)
- guiSetText ( playerCashGUI, "Money: $"..playerCash.."" )
- guiSetText ( playerPlayedDMGUI, "DMs: "..playerPlayedDM.."")
- guiSetText ( playerWinsDMGUI, "Wins [DM]: "..playerWinsDM.."" )
- guiSetText ( playerRatioDMGUI, "Ratio [DM]: "..playerRatioDM.."%")
- guiSetText ( playerPlayedDDGUI, "DDs: "..playerPlayedDD.."")
- guiSetText ( playerWinsDDGUI, "Wins [DD]: "..playerWinsDD.."" )
- guiSetText ( playerRatioDDGUI, "Ratio [DD]: "..playerRatioDD.."%")
- guiSetText ( playerPlayedTimeGUI, "Played Time: "..convertTime(playerPlayedTime).."")
- guiSetText ( playerHuntersGUI, "Hunters: "..playerHunters.."")
- guiSetText ( playerMapBuysGUI, "Map Buys: "..playerMapBuys.."")
- guiSetText ( playerACCountGUI, "Achievements: "..playerACCount.."/20")
- guiSetText ( playerTopTimesGUI, "Top Times: "..playerTopTimes.."")
- end
- else
- callServerFunction("loadStats", who,getLocalPlayer())
- end
- end
- --[[function saveUserData()
- userdata = {}
- for i=1,20 do
- userdata[i] = guiGetText(UserDataGUI[i])
- end
- callServerFunction("NewUserDataFromPanel",userdata,getLocalPlayer())
- end]]--
- function Buttons(button)
- if source == PlayersListGUI then
- local playerName = guiGridListGetItemText ( PlayersListGUI, guiGridListGetSelectedItem ( PlayersListGUI ), 1 )
- if playerName and playerName ~= "" then
- local thePlayer = findPlayerByName (playerName)
- if thePlayer then
- refreshPanelData(thePlayer)
- end
- end
- elseif source == BuyMapGUI then
- local row,column = guiGridListGetSelectedItem(MapsGridListGUI)
- local mapName = guiGridListGetItemText(MapsGridListGUI,row,1)
- callServerFunction("buyMap",getLocalPlayer(),mapName)
- elseif source == unBuyMapGUI then
- callServerFunction("unbuyMap",getLocalPlayer())
- --[[elseif source == playerUserDataGUI then
- local row,column = guiGridListGetSelectedItem(PlayersListGUI)
- local playerName = guiGridListGetItemText(PlayersListGUI,row,1)
- if playerName and playerName ~= "" then
- guiToggleVisible()
- addEventHandler("onClientRender",gRoot,ShowWindow2)
- callServerFunction("getUserStats", getLocalPlayer(), findPlayerByName (playerName))
- else
- outputChatBox("#00AAFF# #FFFFFFERROR! Choose a player from the list!",255,255,255,true)
- end
- elseif source == CloseButtonGUI then
- addEventHandler ( "onClientRender", gRoot, HideWindow2 )--]]
- else
- for i=1,#topButtons do
- if source == topButton[i] then
- callServerFunction("getDataFromServerAndSendToClient",getLocalPlayer() , topButtons[i][2])
- end
- end
- for i=1,#shaders do
- if source == shaderCheckBox[i] then
- if source == shaderCheckBox[1] then
- if guiCheckBoxGetSelected(source) then
- CarShaderToggle(getLocalPlayer(),1)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,1)
- else
- CarShaderToggle(getLocalPlayer(),0)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,0)
- end
- elseif source == shaderCheckBox[2] then
- if guiCheckBoxGetSelected(source) then
- WaterShaderToggle(getLocalPlayer(),1)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,1)
- else
- WaterShaderToggle(getLocalPlayer(),0)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,0)
- end
- elseif source == shaderCheckBox[3] then
- if guiCheckBoxGetSelected(source) then
- ShineShaderToggle(getLocalPlayer(),1)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,1)
- else
- ShineShaderToggle(getLocalPlayer(),0)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,0)
- end
- elseif source == shaderCheckBox[4] then
- if guiCheckBoxGetSelected(source) then
- ContrastShaderToggle(getLocalPlayer(),1)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,1)
- else
- ContrastShaderToggle(getLocalPlayer(),0)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,0)
- end
- elseif source == shaderCheckBox[5] then
- if guiCheckBoxGetSelected(source) then
- SnowShaderToggle(getLocalPlayer(),1)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,1)
- else
- SnowShaderToggle(getLocalPlayer(),0)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,0)
- end
- elseif source == shaderCheckBox[6] then
- if guiCheckBoxGetSelected(source) then
- GoldShaderToggle(getLocalPlayer(),1)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,1)
- else
- GoldShaderToggle(getLocalPlayer(),0)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,0)
- end
- elseif source == shaderCheckBox[7] then
- if guiCheckBoxGetSelected(source) then
- SkidmarksShaderToggle(getLocalPlayer(),1)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,1)
- else
- SkidmarksShaderToggle(getLocalPlayer(),0)
- callServerFunction("ShadersUpdate",getLocalPlayer(),i,0)
- end
- end
- end
- end
- end
- end
- --[[function UserStats(data)
- for i=1,#data do
- guiSetText ( PlayerDataGUI[i], data[i] )
- end
- end]]--
- function MapsFilterGUIChanged()
- if source == MapsFilterGUI then
- guiGridListClear(MapsGridListGUI)
- callServerFunction("getServerMaps",getLocalPlayer(),guiGetText ( MapsFilterGUI ))
- end
- for i=1,20 do
- if source == UserDataGUI[i] then
- UserDataChanged = 1
- end
- end
- end
- addEventHandler("onClientGUIChanged", getRootElement(), MapsFilterGUIChanged)
- function loadMaps(gamemodeMapTable, gamemode, map,s)
- guiGridListClear(MapsGridListGUI)
- if gamemodeMapTable then
- aGamemodeMapTable = gamemodeMapTable
- for id,gamemode in pairs (gamemodeMapTable) do
- if (gamemode.name == "Race") then
- for id,map in ipairs (gamemode.maps) do
- if s then
- if string.find(string.lower(map.name),string.lower(s)) then
- local row = guiGridListAddRow ( MapsGridListGUI )
- guiGridListSetItemText ( MapsGridListGUI, row, 1, map.name, false, false )
- guiGridListSetItemData ( MapsGridListGUI, row, 1, map.resname)
- end
- else
- local row = guiGridListAddRow ( MapsGridListGUI )
- guiGridListSetItemText ( MapsGridListGUI, row, 1, map.name, false, false )
- guiGridListSetItemData ( MapsGridListGUI, row, 1, map.resname)
- end
- end
- end
- end
- end
- end
- ------------------------------------------
- -- Achievements
- ------------------------------------------
- function unlockAChievement(Achievement)
- LastACName = AchievementsName[Achievement]
- Move = -400
- Alpha = 255
- Rotation = 0
- addEventHandler ( "onClientRender", gRoot, AchievementUnlockedRender)
- playSound ( "img/ACUnlocked.wav")
- end
- function AchievementUnlockedRender()
- Rotation = Rotation + 2
- if Move <= 5 then
- dxDrawImage ( Move, (sH/2), 400, 100, "img/AchievementUnlocked.png" , 0, 0, 0,tocolor(255,255,255,Alpha),true)
- dxDrawImage ( Move, (sH/2), 100, 100, "img/AchievementUnlocked2.png" , Rotation, 0, 0,tocolor(255,255,255,Alpha),true)
- dxDrawText ( "Achievement Unlocked: \n\n"..LastACName.."", Move+80, (sH/2)+10, 400,100,tocolor(0,170,255,Alpha), 0.7,"bankgothic", "left", "top",false,false,true )
- else
- dxDrawImage ( 20, (sH/2), 400, 100, "img/AchievementUnlocked.png" , 0, 0, 0,tocolor(255,255,255,Alpha),true)
- dxDrawImage ( 20, (sH/2), 100, 100, "img/AchievementUnlocked2.png" , Rotation, 0, 0,tocolor(255,255,255,Alpha),true)
- dxDrawText ( "Achievement Unlocked: \n\n"..LastACName.."", 110, (sH/2)+10, 400,100,tocolor(0,170,255,Alpha), 0.7,"bankgothic", "left", "top",false,false,true )
- end
- if Move <= 5000 then
- Move = Move + 20
- else
- Alpha = Alpha - 5
- end
- if Alpha <= 0 then
- removeEventHandler ( "onClientRender", gRoot, AchievementUnlockedRender)
- end
- end
- function convertTime(timeinseconds)
- Days = math.floor(timeinseconds/86400)
- timeinseconds = timeinseconds - Days*86400
- Hours = math.floor(timeinseconds/3600)
- timeinseconds = timeinseconds - Hours*3600
- Minutes = math.floor(timeinseconds/60)
- timeinseconds = timeinseconds - Minutes*60
- Seconds = timeinseconds
- if Days > 0 then
- Time = Days.." days "..Hours.."h "..Minutes.."m "..Seconds.."s"
- elseif Hours > 0 then
- Time = Hours.."h "..Minutes.."m "..Seconds.."s"
- elseif Minutes > 0 then
- Time = Minutes.."m "..Seconds.."s"
- else
- Time = Seconds.."s"
- end
- return Time
- end
- ------------------------------------------
- -- Tops
- ------------------------------------------
- function SortTops(datatype,playerData,thePlayer,beforer,afterer)
- guiGridListClear(TopGrid)
- if ColC then guiGridListRemoveColumn ( TopGrid, ColC ) end
- ColC = guiGridListAddColumn ( TopGrid, string.sub(datatype,5,-2), 0.2 )
- table.sort(playerData, function(x,y) return x.dType > y.dType end)
- for k, v in ipairs(playerData) do
- if afterer ~= " " then
- local row = guiGridListAddRow ( TopGrid )
- guiGridListSetItemText ( TopGrid, row, 1, k, false, true )
- guiGridListSetItemText ( TopGrid, row, 2, playerData[k].pName, false, false )
- guiGridListSetItemText ( TopGrid, row, 3, string.format("%s%s%s",beforer, tostring(math.round(playerData[k].dType,2)),afterer), false, true )
- if k == 1 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,0,255 )
- elseif k == 2 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,255,255 )
- elseif k == 3 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 150,100,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 150,100,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 150,100,0,255 )
- elseif k > 3 and k < 131 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 125+k,125+k,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 125+k,125+k,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 125+k,125+k,255,255 )
- else
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,255,255 )
- end
- if getPlayerName(thePlayer) == tostring(playerData[k].pName) then
- guiGridListSetSelectedItem ( TopGrid,row, 1)
- guiGridListSetItemColor ( TopGrid, row , 1 , 0,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 0,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 0,255,0,255 )
- end
- else
- local row = guiGridListAddRow ( TopGrid )
- guiGridListSetItemText ( TopGrid, row, 1, k, false, true )
- guiGridListSetItemText ( TopGrid, row, 2, playerData[k].pName, false, false )
- guiGridListSetItemText ( TopGrid, row, 3, string.format("%s%s%s",beforer, convertTime(playerData[k].dType),afterer), false, true )
- if k == 1 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,0,255 )
- elseif k == 2 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,255,255 )
- elseif k == 3 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 150,100,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 150,100,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 150,100,0,255 )
- elseif k > 3 and k < 131 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 125+k,125+k,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 125+k,125+k,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 125+k,125+k,255,255 )
- else
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,255,255 )
- end
- if getPlayerName(thePlayer) == tostring(playerData[k].pName) then
- guiGridListSetSelectedItem ( TopGrid,row, 1)
- guiGridListSetItemColor ( TopGrid, row , 1 , 0,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 0,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 0,255,0,255 )
- end
- end
- end
- end
- function SortTopsMaps(datatype,playerData,thePlayer,beforer,afterer)
- guiGridListClear(TopGrid)
- if ColC then guiGridListRemoveColumn ( TopGrid, ColC ) end
- ColC = guiGridListAddColumn ( TopGrid, "Played", 0.2 )
- table.sort(playerData, function(x,y) return x.dType > y.dType end)
- for k, v in ipairs(playerData) do
- if afterer ~= " " then
- local row = guiGridListAddRow ( TopGrid )
- guiGridListSetItemText ( TopGrid, row, 1, k, false, true )
- guiGridListSetItemText ( TopGrid, row, 2, playerData[k].pName, false, false )
- guiGridListSetItemText ( TopGrid, row, 3, string.format("%s%s%s",beforer, tostring(math.round(playerData[k].dType,2)),afterer), false, true )
- if k == 1 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,0,255 )
- elseif k == 2 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,255,255 )
- elseif k == 3 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 150,100,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 150,100,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 150,100,0,255 )
- elseif k > 3 and k < 131 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 125+k,125+k,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 125+k,125+k,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 125+k,125+k,255,255 )
- else
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,255,255 )
- end
- if getPlayerName(thePlayer) == tostring(playerData[k].pName) then
- guiGridListSetSelectedItem ( TopGrid,row, 1)
- guiGridListSetItemColor ( TopGrid, row , 1 , 0,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 0,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 0,255,0,255 )
- end
- else
- local row = guiGridListAddRow ( TopGrid )
- guiGridListSetItemText ( TopGrid, row, 1, k, false, true )
- guiGridListSetItemText ( TopGrid, row, 2, playerData[k].pName, false, false )
- guiGridListSetItemText ( TopGrid, row, 3, string.format("%s%s%s",beforer, convertTime(playerData[k].dType),afterer), false, true )
- if k == 1 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,0,255 )
- elseif k == 2 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,255,255 )
- elseif k == 3 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 150,100,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 150,100,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 150,100,0,255 )
- elseif k > 3 and k < 131 then
- guiGridListSetItemColor ( TopGrid, row , 1 , 125+k,125+k,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 125+k,125+k,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 125+k,125+k,255,255 )
- else
- guiGridListSetItemColor ( TopGrid, row , 1 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 255,255,255,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 255,255,255,255 )
- end
- if getPlayerName(thePlayer) == tostring(playerData[k].pName) then
- guiGridListSetSelectedItem ( TopGrid,row, 1)
- guiGridListSetItemColor ( TopGrid, row , 1 , 0,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 2 , 0,255,0,255 )
- guiGridListSetItemColor ( TopGrid, row , 3 , 0,255,0,255 )
- end
- end
- end
- end
- -----------------
- -- Betting system
- -----------------
- function addNewBet(toPlayerName,newAmount)
- betPlayer = toPlayerName
- betAmount = newAmount
- oldAmount = newAmount
- end
- function triggerBettingSystem(thePlayer,toPlayer,newAmount)
- if oldAmount == nil then
- oldAmount = 0
- end
- if betPlayer == "none" then
- local betState = 0
- callServerFunction("createNewBet",thePlayer,toPlayer,newAmount,oldAmount,betState)
- else
- local betState = getPlayerName(betPlayer)
- callServerFunction("createNewBet",thePlayer,toPlayer,newAmount,oldAmount,betState)
- end
- end
- function clearData()
- betPlayer = "none"
- betAmount = 0
- oldAmount = 0
- end
- function compareResult(winner)
- if (winner == betPlayer) then
- callServerFunction("onPlayerBetWin",getLocalPlayer(),betAmount)
- end
- clearData()
- end
- ---------------
- -- Screen Cash
- ---------------
- --[[CashSize = 0.6
- function refreshCash(cash)
- MyCash = cash
- end
- function showCash()
- if MyCash then
- dxDrawColorTextPuma("#000000Cash $"..MyCash, 16, sH/5.5-1, sW-14, sH-1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $"..MyCash, 16, sH/5.5, sW-14, sH, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $"..MyCash, 16, sH/5.5+1, sW-14, sH+1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $"..MyCash, 15, sH/5.5+1, sW-15, sH+1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $"..MyCash, 14, sH/5.5+1, sW-16, sH+1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $"..MyCash, 14, sH/5.5, sW-16, sH, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $"..MyCash, 14, sH/5.5-1, sW-16, sH-1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $"..MyCash, 15, sH/5.5-1, sW-15, sH-1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#C1FF17Cash #FFFFFF$"..MyCash, 15, sH/5.5, sW-15, sH, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- else
- dxDrawColorTextPuma("#000000Cash $0", 16, sH/5.5-1, sW-14, sH-1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $0", 16, sH/5.5, sW-14, sH, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $0", 16, sH/5.5+1, sW-14, sH+1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $0", 15, sH/5.5+1, sW-15, sH+1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $0", 14, sH/5.5+1, sW-16, sH+1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $0", 14, sH/5.5, sW-16, sH, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $0", 14, sH/5.5-1, sW-16, sH-1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#000000Cash $0", 15, sH/5.5-1, sW-15, sH-1, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- dxDrawColorTextPuma("#C1FF17Cash #FFFFFF$0", 15, sH/5.5, sW-15, sH, tocolor(255,255,255,255), CashSize, "bankgothic", "right", "top")
- end
- end]]--
- ------------------------------------------
- -- Triggering
- ------------------------------------------
- ------------------------------------------
- -- Calling function from the client's side
- ------------------------------------------
- function callClientFunction(funcname, ...)
- local arg = { ... }
- if (arg[1]) then
- for key, value in next, arg do arg[key] = tonumber(value) or value end
- end
- loadstring("return "..funcname)()(unpack(arg))
- end
- addEvent("onServerCallsClientFunction", true)
- addEventHandler("onServerCallsClientFunction", resourceRoot, callClientFunction)
- -----------------------
- -- Call server function
- -----------------------
- function callServerFunction(funcname, ...)
- local arg = { ... }
- if (arg[1]) then
- for key, value in next, arg do
- if (type(value) == "number") then arg[key] = tostring(value) end
- end
- end
- triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg))
- end
- function math.round(number, decimals, method)
- decimals = decimals or 0
- local factor = 10 ^ decimals
- if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
- else return tonumber(("%."..decimals.."f"):format(number)) end
- end
- ------------------------------------------
- -- Nick
- ------------------------------------------
- addEventHandler ("onPlayerJoin",getRootElement(),
- function()
- local playerName = getPlayerName(name)
- savePlayerData(name,"playerName",string.gsub(name,"#%x%x%x%x%x%x", ""))
- end)
- addEventHandler("onPlayerChangeNick",getRootElement(),
- function (olnick,newnick)
- savePlayerData(name,"playerName",string.gsub(newnick,"#%x%x%x%x%x%x", ""))
- end)
- function findPlayerByName (name)
- local player = getPlayerFromName(name)
- if player then return player end
- for i, player in ipairs(getElementsByType("player")) do
- if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), name:lower(), 1, true) then
- return player
- end
- end
- return false
- end
- ------------------------------------------
- -- Tab [8] Shop
- ------------------------------------------
- -- buttons
- myCashGUI = guiCreateButton ( 0.7, 0.1, 0.25, 0.1,"Buy a skin", true, Tab[8] )
- btnChangeHeadlightsColor = guiCreateButton(445,295,123,38,"Headlights color",false,Tab[8])
- btnChangeVehicleColor = guiCreateButton(308,295,123,38,"Vehicle color",false,Tab[8])
- btnChangeNametagColor = guiCreateButton(171,295,123,38,"Buy nametag color",false,Tab[8])
- -- general elements
- myCashGUI = guiCreateLabel ( 33, 266, 123, 19, "Price: $1300", true, Tab[8] )
- guiLabelSetVerticalAlign ( myCashGUI, "center" )
- guiLabelSetHorizontalAlign ( myCashGUI, "center", false )
- guiSetFont ( PriceSkinGUI, "default-bold-small" )
- lblPriceFree1 = guiCreateLabel(445,266,123,19,"Price: FREE",false,Tab[8])
- guiLabelSetVerticalAlign(lblPriceFree1,"center")
- guiLabelSetHorizontalAlign(lblPriceFree1,"center",false)
- guiSetFont(lblPriceFree1,"default-bold-small")
- lblPriceFree2 = guiCreateLabel(308,266,123,19,"Price: FREE",false,Tab[8])
- guiLabelSetVerticalAlign(lblPriceFree2,"center")
- guiLabelSetHorizontalAlign(lblPriceFree2,"center",false)
- guiSetFont(lblPriceFree2,"default-bold-small")
- lblPriceNametag = guiCreateLabel(171,266,123,19,"Price: $2000",false,Tab[8])
- guiLabelSetVerticalAlign(lblPriceNametag,"center")
- guiLabelSetHorizontalAlign(lblPriceNametag,"center",false)
- guiSetFont(lblPriceNametag,"default-bold-small")
- lblWaterColor = guiCreateLabel(389,22,146,18,"Water color",false,Tab[8])
- guiLabelSetColor(lblWaterColor,255,120,0)
- guiLabelSetHorizontalAlign(lblWaterColor,"center",false)
- guiSetFont(lblWaterColor,"default-bold-small")
- lblNewWaterColor = guiCreateLabel(398,40,135,14,"New color (rrr,ggg,bbb)",false,Tab[8])
- guiSetFont(lblNewWaterColor,"default-bold-small")
- lblTime = guiCreateLabel(389,132,146,18,"Time",false,Tab[8])
- guiLabelSetColor(lblTime,255,120,0)
- guiLabelSetHorizontalAlign(lblTime,"center",false)
- guiSetFont(lblTime,"default-bold-small")
- lblNewTime = guiCreateLabel(411,150,135,14,"New time (hh:mm)",false,Tab[8])
- guiSetFont(lblNewTime,"default-bold-small")
- editWaterColorRed = guiCreateEdit(389,58,42,22,"",false,Tab[8])
- editWaterColorGreen = guiCreateEdit(441,58,42,22,"",false,Tab[8])
- editWaterColorBlue = guiCreateEdit(493,58,42,22,"",false,Tab[8])
- editTimeHours = guiCreateEdit(416,171,42,22,"",false,Tab[8])
- editTimeMinutes = guiCreateEdit(468,171,42,22,"",false,Tab[8])
- guiEditSetMaxLength(editWaterColorRed,3)
- guiEditSetMaxLength(editWaterColorGreen,3)
- guiEditSetMaxLength(editWaterColorBlue,3)
- guiEditSetMaxLength(editTimeHours,2)
- guiEditSetMaxLength(editTimeMinutes,2)
- btnChangeWaterColor = guiCreateButton(389,90,146,23,"Change color - $400",false,Tab[8])
- btnChangeTime = guiCreateButton(389,203,146,23,"Change time - $250",false,Tab[8])
- -- horn interface
- gridHorns = guiCreateGridList(24,56,191,154,false,Tab[8])
- guiGridListAddColumn(gridHorns,"Horn",0.6)
- guiGridListAddColumn(gridHorns,"Price",0.3)
- guiGridListSetSortingEnabled(gridHorns,false)
- for _,horn in ipairs(hornName) do
- local row = guiGridListAddRow(gridHorns)
- guiGridListSetItemText(gridHorns,row,1,horn,false,false)
- guiGridListSetItemColor(gridHorns,row,1,180,180,180,255)
- end
- for _,price in ipairs(hornPrice) do
- guiGridListSetItemText(gridHorns,_-1,2,price,false,false)
- guiGridListSetItemColor(gridHorns,_-1,2,180,180,180,255)
- end
- lblCustomHornInfo = guiCreateLabel(24,22,143,16,"Custom horn sounds",false,Tab[8])
- guiLabelSetColor(lblCustomHornInfo,255,120,0)
- guiSetFont(lblCustomHornInfo,"default-bold-small")
- btnSetHornSound = guiCreateButton(24,215,191,24,"Use selected horn",false,Tab[8])
- btnPreviewHorn = guiCreateButton(225,80,83,26,"Preview horn",false,Tab[8])
- btnBuyHorn = guiCreateButton(225,167,83,26,"Buy horn",false,Tab[8])
- lblHornPriceNot = guiCreateLabel(225,127,83,15,"Price:",false,Tab[8])
- guiLabelSetHorizontalAlign(lblHornPriceNot,"center",false)
- guiSetFont(lblHornPriceNot,"default-bold-small")
- lblHornPrice = guiCreateLabel(225,142,83,15,"N/A",false,Tab[8])
- guiLabelSetVerticalAlign(lblHornPrice,"center")
- guiLabelSetHorizontalAlign(lblHornPrice,"center",false)
- guiSetFont(lblHornPrice,"default-bold-small")
- lblCurrentHorn = guiCreateLabel(24,38,175,16,"Current horn: N/A",false,Tab[8])
- guiSetFont(lblCurrentHorn,"default-bold-small")
- -- color pick window
- colorWindow = guiCreateWindow(screenWidth/2-colorWindowWidth/2,screenHeight/2-colorWindowHeight/2,colorWindowWidth,colorWindowHeight,"Select your color...",false)
- guiSetAlpha(colorWindow,0.95)
- guiSetVisible(colorWindow,false)
- labelRed = guiCreateLabel(15,39,102,20,"RED",false,colorWindow)
- guiLabelSetColor(labelRed,255,0,0)
- guiLabelSetVerticalAlign(labelRed,"center")
- guiLabelSetHorizontalAlign(labelRed,"left",false)
- guiSetFont(labelRed,"default-bold-small")
- labelGreen = guiCreateLabel(15,78,101,20,"GREEN",false,colorWindow)
- guiLabelSetColor(labelGreen,0,255,0)
- guiLabelSetVerticalAlign(labelGreen,"center")
- guiLabelSetHorizontalAlign(labelGreen,"left",false)
- guiSetFont(labelGreen,"default-bold-small")
- labelBlue = guiCreateLabel(15,117,100,20,"BLUE",false,colorWindow)
- guiLabelSetColor(labelBlue,0,30,255)
- guiLabelSetVerticalAlign(labelBlue,"center")
- guiLabelSetHorizontalAlign(labelBlue,"left",false)
- guiSetFont(labelBlue,"default-bold-small")
- gridOne = guiCreateGridList(10000,12,0,164,false,colorWindow)
- guiGridListSetSelectionMode(gridOne,2)
- gridTwo = guiCreateGridList(10000,12,0,164,false,colorWindow)
- guiGridListSetSelectionMode(gridTwo,2)
- redBar = guiCreateScrollBar( 0.2, 0.2, 0.69, 0.1, true, true, colorWindow)
- greenBar = guiCreateScrollBar( 0.2, 0.4, 0.69, 0.1, true, true, colorWindow)
- blueBar = guiCreateScrollBar( 0.2, 0.6, 0.69, 0.1, true, true, colorWindow)
- lblColorPreview = guiCreateLabel(15,152,181,31,"Preview [||||||||||||||]",false,colorWindow)
- guiLabelSetVerticalAlign(lblColorPreview,"center")
- guiLabelSetHorizontalAlign(lblColorPreview,"center",false)
- guiSetFont(lblColorPreview,"default-bold-small")
- btnSaveColor = guiCreateButton(214,152,81,31,"Save",false,colorWindow)
- btnCancelColorSelection = guiCreateButton(305,152,77,31,"Cancel",false,colorWindow)
- -- skin window
- skinsWindow = guiCreateWindow(screenWidth/2-SkinWindowWidth/2,screenHeight/2-SkinWindowHeight/2,604,429,"Skins",false)
- guiWindowSetSizable(skinsWindow,false)
- guiSetVisible(skinsWindow, false)
- lblSkinsText = guiCreateLabel(10,27,583,109,"Here you can change your character's skin. Changing the skin costs $1300. For your convenience, the skins are arranged in several groups. \n\nYou can preview skins by clicking on them. Your character's skin will change into the selected one for a few seconds. \n\nWhen you find a skin you want, select it and click the \"Buy skin\" button. This will save the skin to your account and you will play with it until you decide to change it again.",false,skinsWindow)
- guiLabelSetHorizontalAlign(lblSkinsText,"left",true)
- guiSetFont(lblSkinsText,"default-bold-small")
- skin_groupTable = guiCreateGridList(10,157,167,261,false,skinsWindow)
- guiGridListSetSortingEnabled(skin_groupTable, false)
- skin_groupTable_01 = guiGridListAddColumn(skin_groupTable, "Group", 0.8)
- local groupTable_row = nil
- lblSkinLine = guiCreateLabel(16,136,570,11,"--------------------------------------------------------------------------------------------------------------------------------",false,skinsWindow)
- guiLabelSetColor(lblSkinLine,255,120,0)
- guiLabelSetHorizontalAlign(lblSkinLine,"center",false)
- guiSetFont(lblSkinLine,"default-bold-small")
- skin_skinTable = guiCreateGridList(207,157,224,261,false,skinsWindow)
- guiGridListSetSortingEnabled(skin_skinTable, false)
- skin_skinTable_01 = guiGridListAddColumn(skin_skinTable, "ID", 0.454545)
- skin_skinTable_02 = guiGridListAddColumn(skin_skinTable, "Skin Name", 0.454545)
- local skinTable_row = nil
- btnCloseSkinWindow = guiCreateButton(456,382,126,36,"Close",false,skinsWindow)
- btnBuySkin = guiCreateButton(456,232,126,36,"Buy skin",false,skinsWindow)
- lblBuySelectedSkin = guiCreateLabel(456,209,126,18,"Buy the selected skin",false,skinsWindow)
- guiLabelSetColor(lblBuySelectedSkin,255,120,0)
- guiLabelSetHorizontalAlign(lblBuySelectedSkin,"center",false)
- guiSetFont(lblBuySelectedSkin,"default-bold-small")
- lblSkinPrice = guiCreateLabel(456,285,126,18,"Price: $1300",false,skinsWindow)
- guiLabelSetColor(lblSkinPrice,255,120,0)
- guiLabelSetHorizontalAlign(lblSkinPrice,"center",false)
- guiSetFont(lblSkinPrice,"default-bold-small")
- aSkins = aLoadSkins()
- local i = guiGridListAddRow(skin_groupTable)
- guiGridListSetItemText( skin_groupTable, i, skin_groupTable_01, 'All skins', false, false )
- for name, group in pairs(aSkins) do
- local i = guiGridListAddRow(skin_groupTable)
- guiGridListSetItemText( skin_groupTable, i, skin_groupTable_01, name, false, false )
- end
- guiGridListSetSelectedItem( skin_groupTable, i, 1 )
- addEventHandler('onClientGUIClick', skin_groupTable, groupSelected , false)
- guiGridListSetColumnWidth(skin_skinTable,skin_skinTable_01, 50, false)
- guiGridListSetColumnWidth(skin_skinTable,skin_skinTable_02, 140, false)
- addEventHandler('onClientGUIClick', skin_skinTable, skinSelected , false)
- fillTableSkins('All skins')
- -- Skins
- function openSkinsWindowCheck()
- callServerFunction("checkSkinLevel",getLocalPlayer())
- end
- function openSkinsWindow()
- guiSetVisible(skinsWindow,true)
- guiSetVisible(Tab[8],false)
- guiBringToFront(skinsWindow)
- end
- function closeSkinsWindow()
- guiSetVisible(skinsWindow,false)
- guiSetVisible(Tab[8],true)
- end
- function on_buySkinButton_clicked(button, state, absoluteX, absoluteY)
- if (button ~= "left") or (state ~= "up") then
- return
- end
- if (currentSkin) then
- if type(currentSkin) =='number' then
- callServerFunction("saveSkin",getLocalPlayer(),tostring(currentSkin))
- end
- else
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a skin!",255,255,255,true)
- end
- end
- function skinSelected(button, state, absoluteX, absoluteY)
- if (button ~= "left") or (state ~= "up") or source ~= skin_skinTable then
- return
- end
- local x, y = guiGridListGetSelectedItem(source)
- if tonumber(x) and tonumber(y) then
- local skinID = guiGridListGetItemText(source, x, skin_skinTable_01)
- currentSkin = getSkinID(skinID)
- if type(currentSkin) =='number' then
- backToID = backToID or getElementModel(getLocalPlayer())
- if isTimer(skinTimer) then
- killTimer(skinTimer)
- skinTimer = setTimer(function() setElementModel(getLocalPlayer(), backToID) backToID=nil end, 5000, 1 )
- else
- skinTimer = setTimer(function() setElementModel(getLocalPlayer(), backToID) backToID=nil end, 5000, 1 )
- end
- setElementModel(getLocalPlayer(), currentSkin)
- end
- end
- end
- function groupSelected(button, state, absoluteX, absoluteY)
- if (button ~= "left") or (state ~= "up") or source ~= skin_groupTable then
- return
- end
- local x, y = guiGridListGetSelectedItem(source)
- if tonumber(x) and tonumber(y) then
- local groupName = guiGridListGetItemText(source, x, y)
- fillTableSkins(groupName)
- end
- end
- function fillTableSkins ( group )
- if group == 'All skins' or aSkins[group] then
- guiGridListClear(skin_skinTable)
- if group == 'All skins' then
- local used_id = {}
- for name, group in pairs(aSkins) do
- for ID, skin in ipairs(group) do
- if not used_id[skin['model']] then
- local i = guiGridListAddRow(skin_skinTable)
- guiGridListSetItemText( skin_skinTable, i, skin_skinTable_01, skin['model'], false, true )
- guiGridListSetItemText( skin_skinTable, i, skin_skinTable_02, skin['name'], false, false )
- used_id[skin['model']] = skin['model']
- end
- end
- end
- elseif aSkins[group] then
- for ID, skin in ipairs(aSkins[group]) do
- local i = guiGridListAddRow(skin_skinTable)
- guiGridListSetItemText( skin_skinTable, i, skin_skinTable_01, skin['model'], false, true )
- guiGridListSetItemText( skin_skinTable, i, skin_skinTable_02, skin['name'], false, false )
- end
- currentSkin = nil
- end
- end
- end
- function aLoadSkins ()
- local table = {}
- local node = xmlLoadFile ( "skins.xml" )
- if ( node ) then
- local groups = 0
- while ( xmlFindChild ( node, "group", groups ) ~= false ) do
- local group = xmlFindChild ( node, "group", groups )
- local groupn = xmlNodeGetAttribute ( group, "name" )
- table[groupn] = {}
- local skins = 0
- while ( xmlFindChild ( group, "skin", skins ) ~= false ) do
- local skin = xmlFindChild ( group, "skin", skins )
- local id = #table[groupn] + 1
- table[groupn][id] = {}
- table[groupn][id]["model"] = xmlNodeGetAttribute ( skin, "model" )
- table[groupn][id]["name"] = xmlNodeGetAttribute ( skin, "name" )
- skins = skins + 1
- end
- groups = groups + 1
- end
- xmlUnloadFile ( node )
- end
- return table
- end
- -- Handle skins
- local skins = {
- [0]=0, [7]=7, [9]=9, [10]=10, [11]=11,
- [12]=12, [13]=13, [14]=14, [15]=15, [16]=16,
- [17]=17, [18]=18, [19]=19, [20]=20, [21]=21,
- [22]=22, [23]=23, [24]=24, [25]=25, [26]=26,
- [27]=27, [28]=28, [29]=29, [30]=30, [31]=31,
- [32]=32, [33]=33, [34]=34, [35]=35, [36]=36,
- [37]=37, [38]=38, [39]=39, [40]=40, [41]=41,
- [43]=43, [44]=44, [45]=45, [46]=46, [47]=47,
- [48]=48, [49]=49, [50]=50, [51]=51, [52]=52,
- [53]=53, [54]=54, [55]=55, [56]=56, [57]=57,
- [58]=58, [59]=59, [60]=60, [61]=61, [62]=62,
- [63]=63, [64]=64, [66]=66, [67]=67, [68]=68,
- [69]=69, [70]=70, [71]=71, [72]=72, [73]=73,
- [75]=75, [76]=76, [77]=77, [78]=78, [79]=79,
- [80]=80, [81]=81, [82]=82, [83]=83, [84]=84,
- [85]=85, [87]=87, [88]=88, [89]=89, [90]=90,
- [91]=91, [92]=92, [93]=93, [94]=94, [95]=95,
- [96]=96, [97]=97, [98]=98, [99]=99, [100]=100,
- [101]=101, [102]=102, [103]=103, [104]=104, [105]=105,
- [106]=106, [107]=107, [108]=108, [109]=109, [110]=110,
- [111]=111, [112]=112, [113]=113, [114]=114, [115]=115,
- [116]=116, [117]=117, [118]=118, [120]=120, [121]=121,
- [122]=122, [123]=123, [124]=124, [125]=125, [126]=126,
- [127]=127, [128]=128, [129]=129, [130]=130, [131]=131,
- [132]=132, [133]=133, [134]=134, [135]=135, [136]=136,
- [137]=137, [138]=138, [139]=139, [140]=140, [141]=141,
- [142]=142, [143]=143, [144]=144, [145]=145, [146]=146,
- [147]=147, [148]=148, [150]=150, [151]=151, [152]=152,
- [153]=153, [154]=154, [155]=155, [156]=156, [157]=157,
- [158]=158, [159]=159, [160]=160, [161]=161, [162]=162,
- [163]=163, [164]=164, [165]=165, [166]=166, [167]=167,
- [168]=168, [169]=169, [170]=170, [171]=171, [172]=172,
- [173]=173, [174]=174, [175]=175, [176]=176, [177]=177,
- [178]=178, [179]=179, [180]=180, [181]=181, [182]=182,
- [183]=183, [184]=184, [185]=185, [186]=186, [187]=187,
- [188]=188, [189]=189, [190]=190, [191]=191, [192]=192,
- [193]=193, [194]=194, [195]=195, [196]=196, [197]=197,
- [198]=198, [199]=199, [200]=200, [201]=201, [202]=202,
- [203]=203, [204]=204, [205]=205, [206]=206, [207]=207,
- [209]=209, [210]=210, [211]=211, [212]=212, [213]=213,
- [214]=214, [215]=215, [216]=216, [217]=217, [218]=218,
- [219]=219, [220]=220, [221]=221, [222]=222, [223]=223,
- [224]=224, [225]=225, [226]=226, [227]=227, [228]=228,
- [229]=229, [230]=230, [231]=231, [232]=232, [233]=233,
- [234]=234, [235]=235, [236]=236, [237]=237, [238]=238,
- [239]=239, [240]=240, [241]=241, [242]=242, [243]=243,
- [244]=244, [245]=245, [246]=246, [247]=247, [248]=248,
- [249]=249, [250]=250, [251]=251, [252]=252, [253]=253,
- [254]=254, [255]=255, [256]=256, [257]=257, [258]=258,
- [259]=259, [260]=260, [261]=261, [262]=262, [263]=263,
- [264]=264, [274]=274, [275]=275, [276]=276, [277]=277,
- [278]=278, [279]=279, [280]=280, [281]=281, [282]=282,
- [283]=283, [284]=284, [285]=285, [286]=286, [287]=287,
- [288]=288
- }
- function getSkinID ( ID )
- return skins[tonumber(ID)] or false
- end
- -- Headlights
- function requestHeadlights()
- local thePlayer = getLocalPlayer()
- callServerFunction("retrieveLevel",thePlayer)
- end
- function checkLevel(playerLevel)
- if playerLevel >= 5 then
- colorPickMode = "headlights"
- guiSetText(colorWindow,"Select your headlights color...")
- showHLCWindow()
- else
- outputChatBox("#FF6600* #FFFFFFYou need to be at least level #ABCDEF5 #FFFFFFto change your headlights color!",255,255,255,true)
- end
- end
- function showHLCWindow ()
- local self = getLocalPlayer()
- local vehicle = getPedOccupiedVehicle(self)
- if (vehicle) then
- getVisible = guiGetVisible (colorWindow)
- if (getVisible == false) then
- guiSetVisible (colorWindow, true)
- guiBringToFront(colorWindow)
- end
- else
- outputChatBox("#FF6600* #FFFFFFYou need to be in a vehicle to change your headlights color!",255,255,255,true)
- end
- end
- function lightColor()
- if source == redBar or source == greenBar or source == blueBar then
- if colorPickMode == "headlights" then
- local player = source
- local car = getPedOccupiedVehicle(getLocalPlayer()) setVehicleHeadLightColor(car,(guiScrollBarGetScrollPosition(redBar)*2.55),(guiScrollBarGetScrollPosition(greenBar)*2.55),(guiScrollBarGetScrollPosition(blueBar)*2.55))
- end
- guiLabelSetColor(lblColorPreview,guiScrollBarGetScrollPosition(redBar)*2.55,guiScrollBarGetScrollPosition(greenBar)*2.55,guiScrollBarGetScrollPosition(blueBar)*2.55)
- end
- end
- addEventHandler("onClientGUIScroll",gRoot,lightColor)
- -- Nametag color
- function getNametagLevel()
- callServerFunction("getNametagLevel",getLocalPlayer())
- end
- function showNametagWindow()
- if (guiGetVisible(colorWindow) == false) then
- guiSetVisible (colorWindow, true)
- guiBringToFront(colorWindow)
- end
- colorPickMode = "nametag"
- guiSetText(colorWindow,"Select your nametag color...")
- end
- -- Combined from Headlights and Nametags
- function saveData ()
- thePlayer = getLocalPlayer()
- if colorPickMode == "headlights" then
- local colorRed = tonumber(guiScrollBarGetScrollPosition(redBar)*2.55)
- local colorGreen = tonumber(guiScrollBarGetScrollPosition(greenBar)*2.55)
- local colorBlue = tonumber(guiScrollBarGetScrollPosition(blueBar)*2.55)
- --outputChatBox("CLIENT: "..colorRed..","..colorGreen..","..colorBlue.." <---- The arguments passed on",getRootElement())
- triggerServerEvent ("saveHeadlights", getRootElement(), thePlayer, colorRed, colorGreen, colorBlue)
- --outputChatBox("CLIENT: Triggering the event, waiting for a reply from the server...",getRootElement())
- getVisible = guiGetVisible (colorWindow)
- if (getVisible == true) then
- guiSetVisible (colorWindow, false)
- end
- --callServerFunction("achievement27",getLocalPlayer())
- colorPickMode = false
- elseif colorPickMode == "nametag" then
- local colorRed = tonumber(guiScrollBarGetScrollPosition(redBar)*2.55)
- local colorGreen = tonumber(guiScrollBarGetScrollPosition(greenBar)*2.55)
- local colorBlue = tonumber(guiScrollBarGetScrollPosition(blueBar)*2.55)
- callServerFunction("saveNametagColor",thePlayer,colorRed,colorGreen,colorBlue)
- getVisible = guiGetVisible (colorWindow)
- if (getVisible == true) then
- guiSetVisible (colorWindow, false)
- end
- colorPickMode = false
- end
- end
- function closeColorSelectionWindow()
- if guiGetVisible(colorWindow) == true then
- guiSetVisible(colorWindow,false)
- end
- colorPickMode = false
- end
- -- Horns
- function updateHornsOnStart()
- callServerFunction("getPurchasedHorns",getLocalPlayer())
- callServerFunction("getLastSetHorn",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),updateHornsOnStart)
- function updateHorns(thePlayer,h1,h2,h3,h4,h5,h6,h7)
- guiGridListSetItemColor(gridHorns,0,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,0,2,100,255,60,255)
- if h1 == 1 then
- guiGridListSetItemColor(gridHorns,1,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,1,2,100,255,60,255)
- end
- if h2 == 1 then
- guiGridListSetItemColor(gridHorns,2,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,2,2,100,255,60,255)
- end
- if h3 == 1 then
- guiGridListSetItemColor(gridHorns,3,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,3,2,100,255,60,255)
- end
- if h4 == 1 then
- guiGridListSetItemColor(gridHorns,4,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,4,2,100,255,60,255)
- end
- if h5 == 1 then
- guiGridListSetItemColor(gridHorns,5,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,5,2,100,255,60,255)
- end
- if h6 == 1 then
- guiGridListSetItemColor(gridHorns,6,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,6,2,100,255,60,255)
- end
- if h7 == 1 then
- guiGridListSetItemColor(gridHorns,7,1,100,255,60,255)
- guiGridListSetItemColor(gridHorns,7,2,100,255,60,255)
- end
- end
- function setLastUsedHorn(horn)
- if not (horn == 0) then
- setHornSound = horn
- toggleControl("horn",false)
- guiSetText(lblCurrentHorn,"Current horn: "..hornName[horn+1])
- else
- toggleControl("horn",true)
- guiSetText(lblCurrentHorn,"Current horn: Default GTA horn")
- end
- bindKey ("h", "down", playCustomHorn)
- end
- function hornPreview()
- local selectedHorn = guiGridListGetSelectedItem(gridHorns)
- if selectedHorn <= 0 then
- return
- end
- if selectedHorn == 6 then
- local previewHorn = playSound(hornSound[selectedHorn])
- setSoundVolume(previewHorn,0.6)
- else
- local previewHorn = playSound(hornSound[selectedHorn])
- setSoundVolume(previewHorn,0.8)
- end
- end
- function buyHorn()
- local selectedHorn = guiGridListGetSelectedItem(gridHorns)
- if selectedHorn == -1 then
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a horn to buy!",255,255,255,true)
- return
- end
- if selectedHorn == 0 then
- outputChatBox("#FF6600* #FFFFFFERROR! You already own this horn!",255,255,255,true)
- return
- end
- callServerFunction("purchaseHorn",getLocalPlayer(),selectedHorn,hornName[selectedHorn+1])
- end
- function setHornCheck()
- local selectedHorn = guiGridListGetSelectedItem(gridHorns)
- if selectedHorn == -1 then
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a horn!",255,255,255,true)
- return
- end
- if selectedHorn == 0 then
- outputChatBox("#FF6600* #FFFFFFHorn sound has been set to: #ABCDEF"..hornName[selectedHorn+1],255,255,255,true)
- callServerFunction("setLastSetHorn",getLocalPlayer(),selectedHorn)
- setHornSound = 0
- toggleControl("horn",true)
- guiSetText(lblCurrentHorn,"Current horn: Default GTA horn")
- return
- end
- callServerFunction("checkForPurchasedHorn",getLocalPlayer(),selectedHorn)
- end
- function setHorn(horn)
- outputChatBox("#FF6600* #FFFFFFHorn sound has been set to: #ABCDEF"..hornName[horn+1],255,255,255,true)
- callServerFunction("setLastSetHorn",getLocalPlayer(),horn)
- toggleControl("horn",false)
- setHornSound = horn
- guiSetText(lblCurrentHorn,"Current horn: "..hornName[horn+1])
- end
- function updateHornPriceLabel()
- local row = guiGridListGetSelectedItem(gridHorns)
- if (row > 0) then
- local price = guiGridListGetItemText(gridHorns,row,2)
- guiSetText(lblHornPrice,"$"..string.gsub(price," ",""))
- else
- guiSetText(lblHornPrice,"N/A")
- end
- end
- -- Play the actual horn sound
- function playCustomHorn()
- if isControlEnabled("horn") == false then
- if getElementData(getLocalPlayer(),"state") == "alive" then
- if hornNum == 0 then
- callServerFunction("playHornForAllClients",getLocalPlayer(),tostring(hornSound[setHornSound]),setHornSound)
- end
- end
- elseif setHornSound ~= 0 then
- toggleControl("horn",false)
- playCustomHorn()
- end
- end
- function playHornSound(horningPlayer,hornSoundPath,cSetHornSound)
- local numItems = 0
- for k,v in pairs(customHorn) do
- numItems = numItems + 1
- end
- if (cSetHornSound ~= 0) then
- customHorn[numItems+1] = playSound3D(hornSoundPath,0,0,0)
- if horningPlayer == getLocalPlayer() then
- hornNum = numItems+1
- else
- hornNum = 0
- end
- setSoundMaxDistance(customHorn[numItems+1],60)
- if (cSetHornSound == 6) then
- setSoundVolume(customHorn[numItems+1],0.32)
- elseif (cSetHornSound == 5) then
- setSoundVolume(customHorn[numItems+1],0.6)
- elseif (cSetHornSound == 7) then
- setSoundVolume(customHorn[numItems+1],0.73)
- elseif (cSetHornSound == 4) then
- setSoundVolume(customHorn[numItems+1],0.5)
- elseif (cSetHornSound == 1) then
- setSoundVolume(customHorn[numItems+1],0.82)
- else
- setSoundVolume(customHorn[numItems+1],0.6)
- end
- attachElements(customHorn[numItems+1],horningPlayer,0,0,0.5)
- local length = getSoundLength(customHorn[numItems+1])
- detachTimer = setTimer(
- function()
- if (customHorn[numItems+1]) then
- if isElementAttached(customHorn[numItems+1]) == true then
- detachElements(customHorn[numItems+1])
- end
- stopSound(customHorn[numItems+1])
- end
- customHorn[numItems+1] = nil
- hornNum = 0
- end,length-100,1)
- end
- end
- addEvent("onRecieveHorn",true)
- addEventHandler("onRecieveHorn",gRoot,playHornSound)
- -- Buy water color and time
- function buyChangeWaterColor()
- callServerFunction("buyChangeWaterColor",getLocalPlayer(),tonumber(guiGetText(editWaterColorRed)),tonumber(guiGetText(editWaterColorGreen)),tonumber(guiGetText(editWaterColorBlue)))
- end
- function cSetWaterColor(r,g,b)
- setWaterColor(r,g,b)
- end
- function buyChangeTime()
- callServerFunction("buyChangeTime",getLocalPlayer(),tonumber(guiGetText(editTimeHours)),tonumber(guiGetText(editTimeMinutes)))
- end
Add Comment
Please, Sign In to add comment