Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------------------------
- ------------------------------------------
- -- Script by NeXTreme --
- -- --
- -- --
- -- Made for the ASG clan --
- -- --
- ------------------------------------------
- --------------------
- -- Set all variables
- --------------------
- screenWidth, screenHeight = guiGetScreenSize()
- function setVariables()
- killedByAfk = 0
- betPlayer = "none"
- betAmount = 0
- oldAmount = 0
- achievementActive = 0
- end
- addEventHandler("onClientResourceStart",getRootElement(),setVariables)
- function vars2()
- colorPickMode = false
- afkCounter = 1
- tCount = 11
- playerIsChatting = false
- chatRequestMode = false
- chatNotificationMode = false
- chatRequestedBy = "none"
- playerIsBusy = false
- newMessageArrived = false
- setElementData(getLocalPlayer(),"chattingWith","none")
- allowPersonalDetails = true
- allowStats = true
- soundMessage = true
- soundRequest = true
- showOnDeath = false
- useHunterSkin = false
- recentlySavedSettings = false
- customHorn = {}
- hornNum = 0
- setHornSound = 0
- acceptMode = 1
- totalServerMaps = 0
- totalDmMaps = 0
- totalDdMaps = 0
- screenWidth,screenHeight = guiGetScreenSize()
- mainWindowWidth = 619
- mainWindowHeight = 365
- PDWindowWidth = 369
- PDWindowHeight = 370
- CNWindowWidth = 340
- CNWindowHeight = 123
- SWindowWidth = 541
- SWindowHeight = 274
- chatImageSize = 135
- SkinWindowWidth = 604
- SkinWindowHeight = 429
- colorWindowWidth = 405
- colorWindowHeight = 195
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),vars2)
- ------------
- -- Userpanel
- ------------
- -- Create achievements
- achievements = {
- "New kid in town",
- "Easy as",
- "Dominating",
- "Unstoppable",
- "FTW!",
- "Deathstalker",
- "Leveller - Rank I",
- "Leveller - Rank II",
- "Leveller - Rank III",
- "Leveller - Rank IV",
- "Levelling Champion",
- "Elite Leveller - Rank I",
- "Elite Leveller - Rank II",
- "Elite Leveller - Rank III",
- "Elite Levelling Champion",
- "Hunter magnet",
- "Master of disaster",
- "King of the sky",
- "My very own toptime",
- "Toptime expert",
- "Gaming spree",
- "All-time player",
- "Connect frenzy",
- "Climbing the ladder",
- "Money saver",
- "Blue-collar millionaire",
- "Colors are fun",
- "Pimp my ride",
- "Communicative gamer award",
- "Charity",
- "Glimpse of the future",
- "Centurion",
- "Milestone",
- "Millennium",
- "Socializer",
- "Speed writer",
- "Quick reflexes",
- "I care how I look",
- "Horn lover",
- "Achievement Hunter"}
- details = {
- "Join the server for the first time.",
- "Win on 10 maps.",
- "Win on 50 maps.",
- "Win on 100 maps.",
- "Win on 200 maps.",
- "Die 300 times.",
- "Reach level 5.",
- "Reach level 10.",
- "Reach level 15.",
- "Reach level 20.",
- "Reach level 25.",
- "Reach level 10 ELITE.",
- "Reach level 15 ELITE.",
- "Reach level 20 ELITE.",
- "Reach level 25 ELITE.",
- "Get 10 hunters.",
- "Get 50 hunters.",
- "Get 100 hunters.",
- "Set a top hunter time.",
- "Set 10 top hunter times.",
- "Play for 20 hours.",
- "Play for 50 hours.",
- "Join the server 40 times.",
- "Get a total of $10,000.",
- "Get a total of $100,000.",
- "Get a total of $1,000,000.",
- "Change your headlights color.",
- "Change your vehicle color.",
- "Start a chat with someone.",
- "Send some money to a player.",
- "Buy a next map.",
- "Play a total of 100 maps.",
- "Play a total of 500 maps.",
- "Play a total of 1000 maps.",
- "Update your personal details.",
- "Win 15 reaction tests.",
- "Win a reaction test in 5 seconds or less.",
- "Buy any skin from the shop.",
- "Buy any horn from the shop.",
- "Unlock all other achievements."}
- -- 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"}
- function onPlayerResourceStart()
- -- Create all the tabs
- tabs = {
- guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"WARNING! The userpanel has failed to load! Please contact Jems as soon as possible!!",false),
- guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Players",false),
- guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Achievements",false),
- guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Shop",false),
- guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Maps",false),
- guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Options",false)
- }
- guiSetVisible(tabs[1],false)
- guiSetVisible(tabs[2],false)
- guiSetVisible(tabs[3],false)
- guiSetVisible(tabs[4],false)
- guiSetVisible(tabs[5],false)
- guiSetVisible(tabs[6],false)
- -- "Stats" TAB
- lblStats = guiCreateLabel(18,24,150,49,"Stats",false,tabs[1])
- guiLabelSetColor(lblStats,1,176,240)
- guiLabelSetVerticalAlign(lblStats,"top")
- guiLabelSetHorizontalAlign(lblStats,"left",false)
- guiSetFont(lblStats,"sa-header")
- lblPlayerLevel = guiCreateLabel(18,83,136,15,"Level: N/A",false,tabs[1])
- guiSetFont(lblPlayerLevel,"default-bold-small")
- lblPlayerStats = guiCreateLabel(18,201,84,16,"Player stats:",false,tabs[1])
- guiLabelSetColor(lblPlayerStats,1,176,240)
- guiSetFont(lblPlayerStats,"default-bold-small")
- lblPlayerMoney = guiCreateLabel(18,98,151,14,"Money: N/A",false,tabs[1])
- guiLabelSetColor(lblPlayerMoney,255,255,255)
- guiSetFont(lblPlayerMoney,"default-bold-small")
- lblAchievementsUnlocked = guiCreateLabel(18,126,180,14,"Achievements unlocked: 0/40",false,tabs[1])
- guiSetFont(lblAchievementsUnlocked,"default-bold-small")
- lblTotalPlayingTime = guiCreateLabel(18,156,292,15,"Total playing time: N/A",false,tabs[1])
- guiSetFont(lblTotalPlayingTime,"default-bold-small")
- lblNextLevelProgress = guiCreateLabel(335,131,232,45,"Progress to next level:",false,tabs[1])
- guiLabelSetVerticalAlign(lblNextLevelProgress,"top")
- guiLabelSetHorizontalAlign(lblNextLevelProgress,"center",false)
- guiSetFont(lblNextLevelProgress,"default-bold-small")
- lblPlayerLevelRank = guiCreateLabel(388,45,124,22,"Loading...",false,tabs[1])
- guiLabelSetColor(lblPlayerLevelRank,1,176,240)
- guiLabelSetVerticalAlign(lblPlayerLevelRank,"bottom")
- guiLabelSetHorizontalAlign(lblPlayerLevelRank,"center",false)
- guiSetFont(lblPlayerLevelRank,"default-bold-small")
- lblMapsWon = guiCreateLabel(18,242,205,15,"Maps won: N/A",false,tabs[1])
- guiSetFont(lblMapsWon,"default-bold-small")
- lblTotalMapsPlayed = guiCreateLabel(18,227,205,15,"Total maps played: N/A",false,tabs[1])
- guiSetFont(lblTotalMapsPlayed,"default-bold-small")
- lblWinRatio = guiCreateLabel(18,260,205,15,"Map win ratio: N/A",false,tabs[1])
- guiSetFont(lblWinRatio,"default-bold-small")
- lblTotalHunters = guiCreateLabel(18,285,205,15,"Total hunters reached: N/A",false,tabs[1])
- guiSetFont(lblTotalHunters,"default-bold-small")
- lblTotalToptimes = guiCreateLabel(18,306,205,15,"Total toptimes set: N/A",false,tabs[1])
- guiSetFont(lblTotalToptimes,"default-bold-small")
- lblTotalMoney = guiCreateLabel(222,227,205,15,"Total money earned: N/A",false,tabs[1])
- guiSetFont(lblTotalMoney,"default-bold-small")
- lblTimesJoined = guiCreateLabel(18,171,205,15,"Times joined the server: N/A",false,tabs[1])
- guiSetFont(lblTimesJoined,"default-bold-small")
- lblSentMoney = guiCreateLabel(222,242,205,15,"Money sent to players: N/A",false,tabs[1])
- guiSetFont(lblSentMoney,"default-bold-small")
- lblTotalDeaths = guiCreateLabel(447,257,135,15,"Total deaths: N/A",false,tabs[1])
- guiSetFont(lblTotalDeaths,"default-bold-small")
- lblTotalBets = guiCreateLabel(222,270,205,15,"Total bets: N/A",false,tabs[1])
- guiSetFont(lblTotalBets,"default-bold-small")
- lblBetsWon = guiCreateLabel(222,285,205,15,"Bets won: N/A",false,tabs[1])
- guiSetFont(lblBetsWon,"default-bold-small")
- lblMoneyEarnBet = guiCreateLabel(222,307,205,15,"Money earned with betting: N/A",false,tabs[1])
- guiSetFont(lblMoneyEarnBet,"default-bold-small")
- lblTotalReactionTests = guiCreateLabel(447,217,135,15,"Reaction tests won: N/A",false,tabs[1])
- guiSetFont(lblTotalReactionTests,"default-bold-small")
- lblBestReactionTime = guiCreateLabel(447,232,135,15,"Best reaction time: N/A",false,tabs[1])
- guiSetFont(lblBestReactionTime,"default-bold-small")
- progressLevel = guiCreateProgressBar(341,148,219,23,false,tabs[1])
- buttonLevelUp = guiCreateButton(342,176,219,19,"Level up",false,tabs[1])
- imageLevel = guiCreateStaticImage(370,73,161,52,"levels/LEVEL1.png",false,tabs[1])
- -- "Achievements" TAB
- gridAchievements = guiCreateGridList(13,50,335,285,false,tabs[3])
- lblAchievementsUnlockedTab = guiCreateLabel(13,25,180,20,"Achievements unlocked: 0/40",false,tabs[3])
- guiLabelSetColor(lblAchievementsUnlockedTab,1,176,240)
- guiSetFont(lblAchievementsUnlockedTab,"default-bold-small")
- lblClickOnAchievement = guiCreateLabel(373,126,202,32,"Click on an achievement to see it's details!",false,tabs[3])
- guiLabelSetColor(lblClickOnAchievement,1,176,240)
- guiLabelSetVerticalAlign(lblClickOnAchievement,"top")
- guiLabelSetHorizontalAlign(lblClickOnAchievement,"center",true)
- guiSetFont(lblClickOnAchievement,"default-bold-small")
- lblAchievementName = guiCreateLabel(373,185,202,17,"Achievement name: ",false,tabs[3])
- guiLabelSetColor(lblAchievementName,171,205,239)
- guiLabelSetVerticalAlign(lblAchievementName,"top")
- guiLabelSetHorizontalAlign(lblAchievementName,"center",false)
- guiSetFont(lblAchievementName,"default-bold-small")
- lblUnlockCondition = guiCreateLabel(373,250,202,17,"Unlock condition:",false,tabs[3])
- guiLabelSetColor(lblUnlockCondition,171,205,239)
- guiLabelSetVerticalAlign(lblUnlockCondition,"top")
- guiLabelSetHorizontalAlign(lblUnlockCondition,"center",false)
- guiSetFont(lblUnlockCondition,"default-bold-small")
- lblAchievementNameText = guiCreateLabel(373,207,197,31,"N/A",false,tabs[3])
- guiLabelSetColor(lblAchievementNameText,255,255,255)
- guiLabelSetVerticalAlign(lblAchievementNameText,"top")
- guiLabelSetHorizontalAlign(lblAchievementNameText,"center",true)
- lblUnlockConditionText = guiCreateLabel(373,271,202,42,"N/A",false,tabs[3])
- guiLabelSetColor(lblUnlockConditionText,255,255,255)
- guiLabelSetVerticalAlign(lblUnlockConditionText,"top")
- guiLabelSetHorizontalAlign(lblUnlockConditionText,"center",true)
- imageAchievement = guiCreateStaticImage(379,44,191,62,"img/Achievements.png",false,tabs[3])
- guiGridListAddColumn(gridAchievements,"Achievement name",0.9)
- guiGridListSetSortingEnabled(gridAchievements,false)
- for i=1,#achievements do
- local row = guiGridListAddRow (gridAchievements)
- guiGridListSetItemText(gridAchievements,row,1," -- Locked --",false,false)
- guiGridListSetItemColor(gridAchievements,row,1,170,170,170,255)
- end
- -- "Options" TAB
- buttonEditPersonalDetails = guiCreateButton(15,308,167,33,"Edit personal details",false,tabs[6])
- imageOptions = guiCreateStaticImage(209,21,381,84,"img/Options.png",false,tabs[6])
- buttonSaveOptions = guiCreateButton(480,308,110,32,"Save",false,tabs[6])
- checkboxAllowPersonalDetails = guiCreateCheckBox(15,95,282,19,"Allow other players to see my personal details",false,false,tabs[6])
- guiCheckBoxSetSelected(checkboxAllowPersonalDetails,true)
- checkboxAllowStats = guiCreateCheckBox(15,115,282,19,"Allow other players to see my stats",false,false,tabs[6])
- guiCheckBoxSetSelected(checkboxAllowStats,true)
- checkboxShowOnDeath = guiCreateCheckBox(15,279,167,19,"Show userpanel on death",false,false,tabs[6])
- radioChatManual = guiCreateRadioButton(418,140,138,15,"Manual",false,tabs[6])
- radioChatAccept = guiCreateRadioButton(418,160,138,15,"Automatically accept",false,tabs[6])
- radioChatDecline = guiCreateRadioButton(418,181,138,15,"Automatically decline",false,tabs[6])
- guiRadioButtonSetSelected(radioChatManual,true)
- lblGeneralSettings = guiCreateLabel(11,74,98,15,"General settings",false,tabs[6])
- guiLabelSetColor(lblGeneralSettings,1,176,240)
- guiSetFont(lblGeneralSettings,"default-bold-small")
- lblChat1 = guiCreateLabel(411,119,172,15,"Chat - accepting requests",false,tabs[6])
- guiLabelSetColor(lblChat1,1,176,240)
- guiSetFont(lblChat1,"default-bold-small")
- checkboxPlayWithCustomSkin = guiCreateCheckBox(15,150,293,19,"Play with purchased character skin",false,false,tabs[6])
- guiCheckBoxSetSelected(checkboxPlayWithCustomSkin,true)
- checkboxPlayWithCustomVehicleColor = guiCreateCheckBox(15,169,282,19,"Play with custom vehicle color",false,false,tabs[6])
- guiCheckBoxSetSelected(checkboxPlayWithCustomVehicleColor,true)
- lblChat2 = guiCreateLabel(411,214,172,15,"Chat - sound notifications",false,tabs[6])
- guiLabelSetColor(lblChat2,1,176,240)
- guiSetFont(lblChat2,"default-bold-small")
- checkboxSoundMessage = guiCreateCheckBox(414,238,158,17,"Sound on new message",false,false,tabs[6])
- guiCheckBoxSetSelected(checkboxSoundMessage,true)
- checkboxSoundRequest = guiCreateCheckBox(414,259,158,17,"Sound on chat request",false,false,tabs[6])
- guiCheckBoxSetSelected(checkboxSoundRequest,true)
- checkboxCustomNametag = guiCreateCheckBox(15,188,282,19,"Play with purchased nametag color",false,false,tabs[6])
- guiCheckBoxSetSelected(checkboxCustomNametag,true)
- lblSaveNotice = guiCreateLabel(192,308,278,33,"Make sure to click \"Save\" after you are done changing the settings!",false,tabs[6])
- guiLabelSetColor(lblSaveNotice,255,255,150)
- guiLabelSetVerticalAlign(lblSaveNotice,"center")
- guiLabelSetHorizontalAlign(lblSaveNotice,"center",true)
- guiSetFont(lblSaveNotice,"default-bold-small")
- checkboxHunterSkin = guiCreateCheckBox(15,224,282,19,"Use the custom hunter skin",false,false,tabs[6])
- personalDetailsWindow = guiCreateWindow(screenWidth/2-PDWindowWidth/2,screenHeight/2-PDWindowHeight/2,PDWindowWidth,PDWindowHeight,"Personal details",false) -- Window for entering the personal details
- guiSetVisible(personalDetailsWindow,false)
- pDetailsName = guiCreateEdit(138,40,214,25,"",false,personalDetailsWindow)
- pDetailsAge = guiCreateEdit(138,75,212,25,"",false,personalDetailsWindow)
- pDetailsEmail = guiCreateEdit(138,110,212,25,"",false,personalDetailsWindow)
- pDetailsMsn = guiCreateEdit(138,145,212,25,"",false,personalDetailsWindow)
- pDetailsSkype = guiCreateEdit(138,180,212,25,"",false,personalDetailsWindow)
- pDetailsXfire = guiCreateEdit(138,215,212,25,"",false,personalDetailsWindow)
- pDetailsICQ = guiCreateEdit(138,250,212,25,"",false,personalDetailsWindow)
- pDetailsXBL = guiCreateEdit(138,285,212,25,"",false,personalDetailsWindow)
- lblPDName = guiCreateLabel(20,40,101,25,"Name:",false,personalDetailsWindow)
- guiLabelSetColor(lblPDName,1,176,240)
- guiLabelSetVerticalAlign(lblPDName,"center")
- guiLabelSetHorizontalAlign(lblPDName,"center",false)
- guiSetFont(lblPDName,"default-bold-small")
- lblPDAge = guiCreateLabel(20,75,101,25,"Age:",false,personalDetailsWindow)
- guiLabelSetColor(lblPDAge,1,176,240)
- guiLabelSetVerticalAlign(lblPDAge,"center")
- guiLabelSetHorizontalAlign(lblPDAge,"center",false)
- guiSetFont(lblPDAge,"default-bold-small")
- lblPDEmail = guiCreateLabel(20,110,101,25,"eMail address:",false,personalDetailsWindow)
- guiLabelSetColor(lblPDEmail,1,176,240)
- guiLabelSetVerticalAlign(lblPDEmail,"center")
- guiLabelSetHorizontalAlign(lblPDEmail,"center",false)
- guiSetFont(lblPDEmail,"default-bold-small")
- lblPDMsn = guiCreateLabel(20,145,101,25,"MSN:",false,personalDetailsWindow)
- guiLabelSetColor(lblPDMsn,1,176,240)
- guiLabelSetVerticalAlign(lblPDMsn,"center")
- guiLabelSetHorizontalAlign(lblPDMsn,"center",false)
- guiSetFont(lblPDMsn,"default-bold-small")
- lblPDSkype = guiCreateLabel(20,180,101,25,"Skype:",false,personalDetailsWindow)
- guiLabelSetColor(lblPDSkype,1,176,240)
- guiLabelSetVerticalAlign(lblPDSkype,"center")
- guiLabelSetHorizontalAlign(lblPDSkype,"center",false)
- guiSetFont(lblPDSkype,"default-bold-small")
- lblPDXfire = guiCreateLabel(20,215,101,25,"XFire:",false,personalDetailsWindow)
- guiLabelSetColor(lblPDXfire,1,176,240)
- guiLabelSetVerticalAlign(lblPDXfire,"center")
- guiLabelSetHorizontalAlign(lblPDXfire,"center",false)
- guiSetFont(lblPDXfire,"default-bold-small")
- lblPDIcq = guiCreateLabel(20,250,101,25,"ICQ:",false,personalDetailsWindow)
- guiLabelSetColor(lblPDIcq ,1,176,240)
- guiLabelSetVerticalAlign(lblPDIcq ,"center")
- guiLabelSetHorizontalAlign(lblPDIcq ,"center",false)
- guiSetFont(lblPDIcq ,"default-bold-small")
- lblPDXbl = guiCreateLabel(20,285,101,25,"XBL Gamertag:",false,personalDetailsWindow)
- guiLabelSetColor(lblPDXbl,1,176,240)
- guiLabelSetVerticalAlign(lblPDXbl,"center")
- guiLabelSetHorizontalAlign(lblPDXbl,"center",false)
- guiSetFont(lblPDXbl,"default-bold-small")
- buttonPersonalDetailsSave = guiCreateButton(224,326,126,35,"Save",false,personalDetailsWindow)
- -- "Players" TAB
- gridOnlinePlayers = guiCreateGridList(20,51,162,280,false,tabs[2])
- guiGridListSetSortingEnabled(gridOnlinePlayers, false)
- guiGridListAddColumn(gridOnlinePlayers,"Name",0.9)
- for _,player in ipairs(getElementsByType("player")) do
- local row = guiGridListAddRow (gridOnlinePlayers)
- guiGridListSetItemText(gridOnlinePlayers,row,1,string.gsub(getPlayerName(player),"#%x%x%x%x%x%x", ""),false,false)
- end
- lblConnectedPlayers = guiCreateLabel(20,26,162,19,"Connected players",false,tabs[2])
- guiLabelSetColor(lblConnectedPlayers,1,176,240)
- guiLabelSetVerticalAlign(lblConnectedPlayers,"center")
- guiLabelSetHorizontalAlign(lblConnectedPlayers,"center",false)
- guiSetFont(lblConnectedPlayers,"default-bold-small")
- btnViewPersonalDetails = guiCreateButton(196,51,128,36,"View personal details",false,tabs[2])
- btnViewStats = guiCreateButton(196,96,128,36,"View stats",false,tabs[2])
- btnGiveMoney = guiCreateButton(417,288,130,43,"Send money",false,tabs[2])
- btnClearChat = guiCreateButton(196,206,128,26,"Clear chat",false,tabs[2])
- btnChatAIO = guiCreateButton(196,160,128,36,"Chat with player",false,tabs[2])
- guiSetFont(btnChatAIO,"default-bold-small")
- lblChattingWNotice = guiCreateLabel(343,26,80,19,"Chatting with:",false,tabs[2])
- guiSetFont(lblChattingWNotice,"default-bold-small")
- lblChattingWith = guiCreateLabel(427,26,153,19,"Nobody",false,tabs[2])
- guiLabelSetColor(lblChattingWith,255,0,0)
- guiSetFont(lblChattingWith,"default-bold-small")
- btnSendInputMessage = guiCreateButton(528,206,52,25,"Send",false,tabs[2])
- playerStatsWindow = guiCreateWindow(screenWidth/2-SWindowWidth/2,screenHeight/2-SWindowHeight/2,SWindowWidth,SWindowHeight,"Loading, please wait...",false)
- guiWindowSetSizable(playerStatsWindow,false)
- guiSetVisible(playerStatsWindow,false)
- lblPStats = guiCreateLabel(17,22,107,49,"Stats",false,playerStatsWindow)
- guiLabelSetColor(lblPStats,1,176,240)
- guiSetFont(lblPStats,"sa-header")
- lblPLevel = guiCreateLabel(17,81,97,16,"Level: N/A",false,playerStatsWindow)
- guiSetFont(lblPLevel,"default-bold-small")
- lblPMoney = guiCreateLabel(17,97,129,16,"Money: N/A",false,playerStatsWindow)
- guiSetFont(lblPMoney,"default-bold-small")
- lblPAchievementsUnlocked = guiCreateLabel(17,123,204,18,"Achievements unlocked: 0/40",false,playerStatsWindow)
- guiSetFont(lblPAchievementsUnlocked,"default-bold-small")
- lblPTimesJoined = guiCreateLabel(17,141,204,18,"Times joined the server: N/A",false,playerStatsWindow)
- guiSetFont(lblPTimesJoined,"default-bold-small")
- lblPLevel2 = guiCreateLabel(327,39,121,16,"Loading...",false,playerStatsWindow)
- guiLabelSetColor(lblPLevel2,1,176,240)
- guiLabelSetVerticalAlign(lblPLevel2,"center")
- guiLabelSetHorizontalAlign(lblPLevel2,"center",false)
- guiSetFont(lblPLevel2,"default-bold-small")
- lblPTotalMapsPlayed = guiCreateLabel(17,162,230,14,"Total maps played: N/A",false,playerStatsWindow)
- guiSetFont(lblPTotalMapsPlayed,"default-bold-small")
- lblPMapsWon = guiCreateLabel(17,178,230,14,"Maps won: N/A",false,playerStatsWindow)
- guiSetFont(lblPMapsWon,"default-bold-small")
- lblPWinRatio = guiCreateLabel(17,193,230,14,"Map win ratio: Calculating...",false,playerStatsWindow)
- guiSetFont(lblPWinRatio,"default-bold-small")
- lblPTotalHunters = guiCreateLabel(17,212,230,14,"Total hunters reached: N/A",false,playerStatsWindow)
- guiSetFont(lblPTotalHunters,"default-bold-small")
- lblPTotalToptimes = guiCreateLabel(17,226,230,14,"Total toptimes set: N/A",false,playerStatsWindow)
- guiSetFont(lblPTotalToptimes,"default-bold-small")
- lblPTotalMoneyEarned = guiCreateLabel(247,141,230,18,"Total money earned: N/A",false,playerStatsWindow)
- guiSetFont(lblPTotalMoneyEarned,"default-bold-small")
- lblPMoneySent = guiCreateLabel(247,159,230,14,"Money sent to players: N/A",false,playerStatsWindow)
- guiSetFont(lblPMoneySent,"default-bold-small")
- lblPMoneyBetEarned = guiCreateLabel(247,208,230,14,"Money earned with betting: N/A",false,playerStatsWindow)
- guiSetFont(lblPMoneyBetEarned,"default-bold-small")
- lblPTotalBets = guiCreateLabel(247,178,138,15,"Total bets: N/A",false,playerStatsWindow)
- guiSetFont(lblPTotalBets,"default-bold-small")
- lblPBetsWon = guiCreateLabel(247,193,138,15,"Bets won: N/A",false,playerStatsWindow)
- guiSetFont(lblPBetsWon,"default-bold-small")
- lblPTotalDeaths = guiCreateLabel(17,245,138,15,"Total deaths: N/A",false,playerStatsWindow)
- guiSetFont(lblPTotalDeaths,"default-bold-small")
- lblPTotalPlayingTime = guiCreateLabel(247,123,230,18,"Total playing time: N/A",false,playerStatsWindow)
- guiSetFont(lblPTotalPlayingTime,"default-bold-small")
- lblPTotalReactionTests = guiCreateLabel(247,231,175,14,"Reaction tests won: N/A",false,playerStatsWindow)
- guiSetFont(lblPTotalReactionTests,"default-bold-small")
- lblPBestReactionTime = guiCreateLabel(247,245,159,14,"Best reaction time: N/A",false,playerStatsWindow)
- guiSetFont(lblPBestReactionTime,"default-bold-small")
- pImageLevel = guiCreateStaticImage(303,61,159,52,"levels/LEVEL1.png",false,playerStatsWindow)
- btnClosePlayerStatsWindow = guiCreateButton(428,226,102,38,"Close",false,playerStatsWindow)
- lblGiveMoneyLineCombo = guiCreateLabel(204,235,376,18,"----------------------------- Send money -----------------------------",false,tabs[2])
- guiLabelSetVerticalAlign(lblGiveMoneyLineCombo,"top")
- guiLabelSetHorizontalAlign(lblGiveMoneyLineCombo,"center",false)
- guiSetFont(lblGiveMoneyLineCombo,"default-bold-small")
- guiLabelSetColor(lblGiveMoneyLineCombo,1,176,240)
- lblGiveMoneyNotice = guiCreateLabel(204,259,372,19,"Please double-check who you're sending the money to!",false,tabs[2])
- guiLabelSetVerticalAlign(lblGiveMoneyNotice ,"center")
- guiLabelSetHorizontalAlign(lblGiveMoneyNotice ,"center",false)
- guiSetFont(lblGiveMoneyNotice,"default-bold-small")
- lblAmountToSend = guiCreateLabel(204,288,94,19,"Amount:",false,tabs[2])
- guiLabelSetVerticalAlign(lblAmountToSend,"top")
- guiLabelSetHorizontalAlign(lblAmountToSend,"center",false)
- editInputChatText = guiCreateEdit(343,206,181,25,"",false,tabs[2])
- editAmountToSend = guiCreateEdit(204,307,94,24,"",false,tabs[2])
- memoPlayerChat = guiCreateMemo(343,41,247,149,"",false,tabs[2])
- guiMemoSetReadOnly(memoPlayerChat,true)
- chatStatusImage = guiCreateStaticImage(screenWidth/1.33-chatImageSize/2,screenHeight/5.8-chatImageSize/2,chatImageSize,chatImageSize,"img/empty.png",false)
- chatRequestNotificationWindow = guiCreateWindow(screenWidth/2-CNWindowWidth/2,screenHeight/2-CNWindowHeight/2,CNWindowWidth,CNWindowHeight,"Chat notification",false)
- guiSetAlpha(chatRequestNotificationWindow,0.95)
- guiSetVisible(chatRequestNotificationWindow,false)
- guiWindowSetSizable(chatRequestNotificationWindow,false)
- btnAcceptChatInvite = guiCreateButton(32,79,125,33,"Accept",false,chatRequestNotificationWindow)
- btnDeclineChatInvite = guiCreateButton(184,79,125,33,"Decline",false,chatRequestNotificationWindow)
- lblChatRequestInformation = guiCreateLabel(14,38,313,18,"<g.data_player> would like to chat with you!",false,chatRequestNotificationWindow)
- guiLabelSetColor(lblChatRequestInformation,1,176,240)
- guiLabelSetVerticalAlign(lblChatRequestInformation,"center")
- guiLabelSetHorizontalAlign(lblChatRequestInformation,"center",false)
- chatRequestingWindow = guiCreateWindow(screenWidth/2-CNWindowWidth/2,screenHeight/2-CNWindowHeight/2,CNWindowWidth,CNWindowHeight,"Sending a chat request",false)
- guiSetAlpha(chatRequestingWindow,0.95)
- guiSetVisible(chatRequestingWindow,false)
- guiWindowSetSizable(chatRequestingWindow,false)
- btnCancelPendingRequest = guiCreateButton(110,79,125,33,"Cancel",false,chatRequestingWindow)
- lblRequestChatAccept = guiCreateLabel(14,38,313,18,"Waiting for <g.data_rPlayer> to accept...",false,chatRequestingWindow)
- guiLabelSetColor(lblRequestChatAccept,1,176,240)
- guiLabelSetVerticalAlign(lblRequestChatAccept,"center")
- guiLabelSetHorizontalAlign(lblRequestChatAccept,"center",false)
- -- "Maps" TAB
- gridMaps = guiCreateGridList(17,51,315,285,false,tabs[5])
- guiGridListSetSortingEnabled(gridMaps,false)
- guiGridListAddColumn(gridMaps,"Map name",0.9)
- lblMapsInfo = guiCreateLabel(342,210,245,45,"You need to be level 17 or higher to set maps. Each map costs $4000, regardless whether it's DM or DD.",false,tabs[5])
- guiLabelSetVerticalAlign(lblMapsInfo,"center")
- guiLabelSetHorizontalAlign(lblMapsInfo,"center",true)
- guiSetFont(lblMapsInfo,"default-bold-small")
- lblTotalMapsOnServer = guiCreateLabel(342,28,193,19,"Total maps on the server: N/A",false,tabs[5])
- guiSetFont(lblTotalMapsOnServer,"default-bold-small")
- lblTotalDmMaps = guiCreateLabel(342,47,193,19,"Total DM maps: N/A",false,tabs[5])
- guiSetFont(lblTotalDmMaps,"default-bold-small")
- lblTotalDdMaps = guiCreateLabel(342,62,193,19,"Total DD maps: N/A",false,tabs[5])
- guiSetFont(lblTotalDdMaps,"default-bold-small")
- lblSetNextMapTitle = guiCreateLabel(342,189,245,16,"Set a next map",false,tabs[5])
- guiLabelSetColor(lblSetNextMapTitle,1,176,240)
- guiLabelSetVerticalAlign(lblSetNextMapTitle,"center")
- guiLabelSetHorizontalAlign(lblSetNextMapTitle,"center",false)
- guiSetFont(lblSetNextMapTitle,"default-bold-small")
- lblSearchForMaps = guiCreateLabel(25,25,101,14,"Search for maps:",false,tabs[5])
- guiLabelSetColor(lblSearchForMaps,1,176,240)
- guiLabelSetVerticalAlign(lblSearchForMaps,"center")
- guiSetFont(lblSearchForMaps,"default-bold-small")
- lblSelectedMapNameTitle = guiCreateLabel(342,97,245,16,"Selected map name:",false,tabs[5])
- guiLabelSetColor(lblSelectedMapNameTitle,150,255,150)
- guiSetFont(lblSelectedMapNameTitle,"default-bold-small")
- lblSelectedMapAuthorTitle = guiCreateLabel(342,136,245,16,"Map type:",false,tabs[5])
- guiLabelSetColor(lblSelectedMapAuthorTitle,150,255,150)
- guiSetFont(lblSelectedMapAuthorTitle,"default-bold-small")
- lblSelectedMapName = guiCreateLabel(342,113,245,16,"N/A",false,tabs[5])
- lblSelectedMapAuthor = guiCreateLabel(342,152,245,16,"N/A",false,tabs[5])
- lblMapTabLine1 = guiCreateLabel(342,309,245,27,"---------------------------------------------------------------",false,tabs[5])
- guiLabelSetColor(lblMapTabLine1,1,176,240)
- guiLabelSetVerticalAlign(lblMapTabLine1,"center")
- guiLabelSetHorizontalAlign(lblMapTabLine1,"center",false)
- guiSetFont(lblMapTabLine1,"default-bold-small")
- lblMapTabLine2 = guiCreateLabel(342,173,245,16,"---------------------------------------------------------------",false,tabs[5])
- guiLabelSetColor(lblMapTabLine2,1,176,240)
- guiLabelSetVerticalAlign(lblMapTabLine2,"center")
- guiLabelSetHorizontalAlign(lblMapTabLine2,"center",false)
- guiSetFont(lblMapTabLine2,"default-bold-small")
- lblMapTabLine3 = guiCreateLabel(342,81,245,16,"---------------------------------------------------------------",false,tabs[5])
- guiLabelSetColor(lblMapTabLine3,1,176,240)
- guiLabelSetVerticalAlign(lblMapTabLine3,"center")
- guiLabelSetHorizontalAlign(lblMapTabLine3,"center",false)
- guiSetFont(lblMapTabLine3,"default-bold-small")
- editMapSearch = guiCreateEdit(129,23,198,21,"",false,tabs[5])
- btnBuyNextMap = guiCreateButton(380,265,169,44,"Buy as next map - $4000",false,tabs[5])
- -- "Shop" TAB
- -- buttons
- btnOpenSkinsWindow = guiCreateButton(33,295,123,38,"Buy a skin",false,tabs[4])
- btnChangeHeadlightsColor = guiCreateButton(445,295,123,38,"Headlights color",false,tabs[4])
- btnChangeVehicleColor = guiCreateButton(308,295,123,38,"Vehicle color",false,tabs[4])
- btnChangeNametagColor = guiCreateButton(171,295,123,38,"Buy nametag color",false,tabs[4])
- -- general elements
- lblPriceSkin = guiCreateLabel(33,266,123,19,"Price: $1300",false,tabs[4])
- guiLabelSetVerticalAlign(lblPriceSkin,"center")
- guiLabelSetHorizontalAlign(lblPriceSkin,"center",false)
- guiSetFont(lblPriceSkin,"default-bold-small")
- lblPriceFree1 = guiCreateLabel(445,266,123,19,"Price: $2000",false,tabs[4])
- guiLabelSetVerticalAlign(lblPriceFree1,"center")
- guiLabelSetHorizontalAlign(lblPriceFree1,"center",false)
- guiSetFont(lblPriceFree1,"default-bold-small")
- lblPriceFree2 = guiCreateLabel(308,266,123,19,"Price: $2000",false,tabs[4])
- guiLabelSetVerticalAlign(lblPriceFree2,"center")
- guiLabelSetHorizontalAlign(lblPriceFree2,"center",false)
- guiSetFont(lblPriceFree2,"default-bold-small")
- lblPriceNametag = guiCreateLabel(171,266,123,19,"Price: FREE",false,tabs[4])
- guiLabelSetVerticalAlign(lblPriceNametag,"center")
- guiLabelSetHorizontalAlign(lblPriceNametag,"center",false)
- guiSetFont(lblPriceNametag,"default-bold-small")
- lblWaterColor = guiCreateLabel(389,22,146,18,"Water color",false,tabs[4])
- guiLabelSetColor(lblWaterColor,1,176,240)
- guiLabelSetHorizontalAlign(lblWaterColor,"center",false)
- guiSetFont(lblWaterColor,"default-bold-small")
- lblNewWaterColor = guiCreateLabel(398,40,135,14,"New color (rrr,ggg,bbb)",false,tabs[4])
- guiSetFont(lblNewWaterColor,"default-bold-small")
- lblTime = guiCreateLabel(389,132,146,18,"Time",false,tabs[4])
- guiLabelSetColor(lblTime,1,176,240)
- guiLabelSetHorizontalAlign(lblTime,"center",false)
- guiSetFont(lblTime,"default-bold-small")
- lblNewTime = guiCreateLabel(411,150,135,14,"New time (hh:mm)",false,tabs[4])
- guiSetFont(lblNewTime,"default-bold-small")
- editWaterColorRed = guiCreateEdit(389,58,42,22,"",false,tabs[4])
- editWaterColorGreen = guiCreateEdit(441,58,42,22,"",false,tabs[4])
- editWaterColorBlue = guiCreateEdit(493,58,42,22,"",false,tabs[4])
- editTimeHours = guiCreateEdit(416,171,42,22,"",false,tabs[4])
- editTimeMinutes = guiCreateEdit(468,171,42,22,"",false,tabs[4])
- 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,tabs[4])
- btnChangeTime = guiCreateButton(389,203,146,23,"Change time - $250",false,tabs[4])
- -- horn interface
- gridHorns = guiCreateGridList(24,56,191,154,false,tabs[4])
- 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,tabs[4])
- guiLabelSetColor(lblCustomHornInfo,1,176,240)
- guiSetFont(lblCustomHornInfo,"default-bold-small")
- btnSetHornSound = guiCreateButton(24,215,191,24,"Use selected horn",false,tabs[4])
- btnPreviewHorn = guiCreateButton(225,80,83,26,"Preview horn",false,tabs[4])
- btnBuyHorn = guiCreateButton(225,167,83,26,"Buy horn",false,tabs[4])
- lblHornPriceNot = guiCreateLabel(225,127,83,15,"Price:",false,tabs[4])
- guiLabelSetHorizontalAlign(lblHornPriceNot,"center",false)
- guiSetFont(lblHornPriceNot,"default-bold-small")
- lblHornPrice = guiCreateLabel(225,142,83,15,"N/A",false,tabs[4])
- guiLabelSetVerticalAlign(lblHornPrice,"center")
- guiLabelSetHorizontalAlign(lblHornPrice,"center",false)
- guiSetFont(lblHornPrice,"default-bold-small")
- lblCurrentHorn = guiCreateLabel(24,38,175,16,"Current horn: N/A",false,tabs[4])
- 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,1,176,240)
- 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,1,176,240)
- guiLabelSetHorizontalAlign(lblBuySelectedSkin,"center",false)
- guiSetFont(lblBuySelectedSkin,"default-bold-small")
- lblSkinPrice = guiCreateLabel(456,285,126,18,"Price: $1300",false,skinsWindow)
- guiLabelSetColor(lblSkinPrice,1,176,240)
- 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')
- -- First time join window
- welcomeWindow = guiCreateWindow(screenWidth/2-392,screenHeight/2-214,784,482,"Welcome to ASG//",false)
- guiSetAlpha(welcomeWindow,1)
- guiSetVisible(welcomeWindow,false)
- guiWindowSetSizable(welcomeWindow,false)
- guiWindowSetMovable(welcomeWindow,false)
- lblWelcomeToXSS = guiCreateLabel(9,58,766,83,"Welcome to ASG//",false,welcomeWindow)
- guiLabelSetColor(lblWelcomeToXSS,1,176,240)
- guiLabelSetHorizontalAlign(lblWelcomeToXSS,"center",false)
- guiSetFont(lblWelcomeToXSS,"sa-gothic")
- lblWelcomeText = guiCreateLabel(9,29,763,359,"\n\n\n\n\n\n\n\n\n\n\nHello and welcome to our server!\n\n\nWe hope you will have fun on our server and enjoy your time with us.\nPlease take your time to read through this guide, as it will only be available once.\n\n\n\n\n\nClick the button to continue...",false,welcomeWindow)
- guiLabelSetHorizontalAlign(lblWelcomeText,"center",false)
- guiSetFont(lblWelcomeText,"clear-normal")
- btnContinue = guiCreateButton(303,393,179,63,"Continue",false,welcomeWindow)
- -------------------------------------------------------------- |END
- callServerFunction("refreshStats",getLocalPlayer())
- setTimer(callServerFunction,5000,1,"checkConvertedMoney",getLocalPlayer()) -- Check for converted money after 5 secs
- -- Event handlers
- addEventHandler ( "onClientGUIClick", buttonLevelUp, triggerLevelUp, false )
- addEventHandler ( "onClientGUIClick", buttonSaveOptions, performSettingsUpdate, false )
- addEventHandler ( "onClientGUIClick", gridAchievements, updateAchievementDetailsLabel, false )
- addEventHandler ( "onClientGUIClick", buttonEditPersonalDetails, togglePersonalDetailsWindow, false )
- addEventHandler ( "onClientGUIClick", buttonPersonalDetailsSave, closePersonalDetailsWindow, false )
- addEventHandler ( "onClientGUIClick", btnViewPersonalDetails, displayPersonalDetailsCall, false )
- addEventHandler ( "onClientGUIClick", btnViewStats, getPersonalStats, false )
- addEventHandler ( "onClientGUIClick", btnClosePlayerStatsWindow, closeStatsWindow, false )
- addEventHandler ( "onClientGUIClick", btnCancelPendingRequest, cancelChatInvitation, false )
- addEventHandler ( "onClientGUIClick", btnGiveMoney, giveMoney, false )
- addEventHandler ( "onClientGUIClick", btnClearChat, clearClientChat, false )
- addEventHandler ( "onClientGUIClick", btnChatAIO, toggleChatMode, false )
- addEventHandler ( "onClientGUIClick", btnSendInputMessage, playerChatHandler, false )
- addEventHandler ( "onClientGUIClick", btnAcceptChatInvite, acceptChatInvitation, false )
- addEventHandler ( "onClientGUIClick", btnDeclineChatInvite, declineChatInvitation, false )
- addEventHandler ( "onClientGUIClick", gridMaps, updateMapLabels, false )
- addEventHandler ( "onClientGUIClick", btnBuyNextMap, buyNextMap, false )
- addEventHandler ( "onClientGUIChanged", editMapSearch, mapSearch, false )
- addEventHandler ( "onClientGUIClick", btnOpenSkinsWindow, openSkinsWindowCheck, false )
- addEventHandler ( "onClientGUIClick", btnBuySkin, on_buySkinButton_clicked,false )
- addEventHandler ( "onClientGUIClick", btnCloseSkinWindow, closeSkinsWindow, false )
- addEventHandler ( "onClientGUIClick", btnChangeVehicleColor, requestVehColor,false )
- addEventHandler ( "onClientGUIClick", btnChangeHeadlightsColor, requestHeadlights,false )
- addEventHandler ( "onClientGUIClick", btnChangeNametagColor, getNametagLevel,false )
- addEventHandler ( "onClientGUIClick", btnCancelColorSelection, closeColorSelectionWindow,false )
- addEventHandler ( "onClientGUIClick", btnSaveColor, saveData, false )
- addEventHandler ( "onClientGUIClick", btnPreviewHorn, hornPreview, false )
- addEventHandler ( "onClientGUIClick", btnSetHornSound, setHornCheck, false )
- addEventHandler ( "onClientGUIClick", btnBuyHorn, buyHorn, false )
- addEventHandler ( "onClientGUIClick", gridHorns, updateHornPriceLabel, false )
- addEventHandler ( "onClientGUIClick", btnChangeWaterColor, buyChangeWaterColor, false )
- addEventHandler ( "onClientGUIClick", btnChangeTime, buyChangeTime, false )
- addEventHandler ( "onClientGUIClick", btnContinue, welcomeProcedureHandler, false )
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),onPlayerResourceStart)
- ---------- Main userpanel functions -----------
- -- Show/hide seperate tabs
- -- This function gets called from the DX Menu script
- function displayTab(openTab)
- if openTab == 1 then -- Stats tab
- guiSetVisible(tabs[2],false)
- guiSetVisible(tabs[3],false)
- guiSetVisible(tabs[4],false)
- guiSetVisible(tabs[5],false)
- guiSetVisible(tabs[6],false)
- guiSetVisible(statsWindow,false)
- guiSetVisible(personalDetailsWindow,false)
- guiSetVisible(colorWindow,false)
- guiSetVisible(skinsWindow,false)
- guiSetVisible(chatRequestingWindow,false)
- guiSetVisible(chatRequestNotificationWindow,false)
- local visible = guiGetVisible(tabs[1])
- if visible == false then
- guiSetVisible(tabs[1],true)
- else
- guiSetVisible(tabs[1],false)
- end
- elseif openTab == 2 then -- Players tab
- guiSetVisible(tabs[1],false)
- guiSetVisible(tabs[3],false)
- guiSetVisible(tabs[4],false)
- guiSetVisible(tabs[5],false)
- guiSetVisible(tabs[6],false)
- guiSetVisible(statsWindow,false)
- guiSetVisible(personalDetailsWindow,false)
- guiSetVisible(colorWindow,false)
- guiSetVisible(skinsWindow,false)
- guiSetVisible(chatRequestingWindow,false)
- guiSetVisible(chatRequestNotificationWindow,false)
- local visible = guiGetVisible(tabs[2])
- if visible == false then
- guiSetVisible(tabs[2],true)
- if newMessageArrived == true then
- newMessageArrived = false
- guiStaticImageLoadImage(chatStatusImage,"img/empty.png")
- end
- if chatRequestMode == true then
- guiSetVisible(chatRequestingWindow,true)
- guiBringToFront(chatRequestingWindow)
- end
- if chatNotificationMode == true then
- guiSetVisible(chatRequestNotificationWindow, true)
- guiBringToFront(chatRequestNotificationWindow)
- end
- else
- guiSetVisible(tabs[2],false)
- guiSetVisible(personalDetailsWindow, false)
- guiSetVisible(chatRequestingWindow, false)
- guiSetVisible(chatRequestNotificationWindow, false)
- if newMessageArrived == false or chatRequestMode == false or chatNotificationMode == false then
- guiStaticImageLoadImage(chatStatusImage,"img/empty.png")
- end
- end
- elseif openTab == 3 then -- Achievements tab
- guiSetVisible(tabs[1],false)
- guiSetVisible(tabs[2],false)
- guiSetVisible(tabs[4],false)
- guiSetVisible(tabs[5],false)
- guiSetVisible(tabs[6],false)
- guiSetVisible(statsWindow,false)
- guiSetVisible(personalDetailsWindow,false)
- guiSetVisible(colorWindow,false)
- guiSetVisible(skinsWindow,false)
- guiSetVisible(chatRequestingWindow,false)
- guiSetVisible(chatRequestNotificationWindow,false)
- local visible = guiGetVisible(tabs[3])
- if visible == false then
- guiSetVisible(tabs[3],true)
- else
- guiSetVisible(tabs[3],false)
- end
- elseif openTab == 4 then -- Shop tab
- guiSetVisible(tabs[1],false)
- guiSetVisible(tabs[2],false)
- guiSetVisible(tabs[3],false)
- guiSetVisible(tabs[5],false)
- guiSetVisible(tabs[6],false)
- guiSetVisible(statsWindow,false)
- guiSetVisible(personalDetailsWindow,false)
- guiSetVisible(colorWindow,false)
- guiSetVisible(skinsWindow,false)
- guiSetVisible(chatRequestingWindow,false)
- guiSetVisible(chatRequestNotificationWindow,false)
- local visible = guiGetVisible(tabs[4])
- if visible == false then
- guiSetVisible(tabs[4],true)
- else
- guiSetVisible(tabs[4],false)
- end
- elseif openTab == 5 then -- Maps tab
- guiSetVisible(tabs[1],false)
- guiSetVisible(tabs[2],false)
- guiSetVisible(tabs[3],false)
- guiSetVisible(tabs[4],false)
- guiSetVisible(tabs[6],false)
- guiSetVisible(statsWindow,false)
- guiSetVisible(personalDetailsWindow,false)
- guiSetVisible(colorWindow,false)
- guiSetVisible(skinsWindow,false)
- guiSetVisible(chatRequestingWindow,false)
- guiSetVisible(chatRequestNotificationWindow,false)
- local visible = guiGetVisible(tabs[5])
- if visible == false then
- guiSetVisible(tabs[5],true)
- else
- guiSetVisible(tabs[5],false)
- end
- elseif openTab == 6 then -- Options tab
- guiSetVisible(tabs[1],false)
- guiSetVisible(tabs[2],false)
- guiSetVisible(tabs[3],false)
- guiSetVisible(tabs[4],false)
- guiSetVisible(tabs[5],false)
- guiSetVisible(statsWindow,false)
- guiSetVisible(personalDetailsWindow,false)
- guiSetVisible(colorWindow,false)
- guiSetVisible(skinsWindow,false)
- guiSetVisible(chatRequestingWindow,false)
- guiSetVisible(chatRequestNotificationWindow,false)
- local visible = guiGetVisible(tabs[6])
- if visible == false then
- guiSetVisible(tabs[6],true)
- else
- guiSetVisible(tabs[6],false)
- end
- elseif openTab == 0 then -- Close all tabs
- guiSetVisible(tabs[1],false)
- guiSetVisible(tabs[2],false)
- guiSetVisible(tabs[3],false)
- guiSetVisible(tabs[4],false)
- guiSetVisible(tabs[5],false)
- guiSetVisible(tabs[6],false)
- guiSetVisible(statsWindow,false)
- guiSetVisible(personalDetailsWindow,false)
- guiSetVisible(colorWindow,false)
- guiSetVisible(skinsWindow,false)
- guiSetVisible(chatRequestingWindow,false)
- guiSetVisible(chatRequestNotificationWindow,false)
- end
- end
- -- Welcome window for new players
- function displayWelcomeWindow()
- if guiGetVisible(welcomeWindow) == false then
- guiSetVisible(welcomeWindow,true)
- guiBringToFront(welcomeWindow)
- showCursor(true)
- fadeCamera(false,0,0,0,0)
- elseif guiGetVisible(welcomeWindow) == true then
- guiSetVisible(welcomeWindow,false)
- showCursor(false)
- fadeCamera(true,10)
- end
- end
- function welcomeProcedureHandler(sStage)
- if (sStage) and (sStage == "openWindow") then
- displayWelcomeWindow()
- stage = 1
- return
- end
- if isTimer(rulesTimer) then
- outputChatBox("#FF6600* #FFFFFFPlease take some time to read through the server rules.",255,255,255,true)
- return
- end
- if stage == 5 then
- displayWelcomeWindow()
- callServerFunction("achievement1",getLocalPlayer())
- return
- end
- welcomeProcedure()
- end
- function welcomeProcedure()
- if (stage == 1) then -- First continue click
- stage = 2
- rulesTimer = setTimer(function () end, 20000,1)
- guiSetText(lblWelcomeToXSS," ")
- guiSetText(lblWelcomeText,"\n---------------------------------------------- Server Rules ----------------------------------------------\n\n\n~ No cheating! Cheaters will be banned forever! ~\n\n~ No vehicle mods! However, skin mods are allowed ~\n\n~ No spamming, swearing and insulting other players ~\n\n~ No camping. Please disconnect if you're AFK ~\n\n~ No bug abusing! Abusers will be severely punished ~\n\n~ No advertising for other clans or websites ~\n\n~ Please report all script-related issues to Jems, or just post it on our website ~\n\n\n\n\n\nWhen you're familiar with the rules, click the 'Continue' button...")
- elseif (stage == 2) then -- Second continue click
- stage = 3
- guiSetText(lblWelcomeText,"\nPress 'F7' to open the userpanel!\n\n\nThe userpanel allows you to view your stats, start private chats with players and buy various items from the shop.\n\nSome functions may be require a certain level to use, so make sure to advance to the next level every once in a while.\n\n\nThe userpanel also allows you to browse your achievements!\nThere are currently 40 achievements available for you to unlock.\n\nYou cannot actually see what the achievement is until you unlock it.\nGood luck discovering them all!\n\n\n\nYour stats like money and level are stored by your serial in a mySQL database.\nThere is no need to login when you join.\n\n\n\n\nClick on the button when you're ready to continue...")
- elseif (stage == 3) then -- Third continue click
- stage = 4
- guiSetText(lblWelcomeText,"\n\n\n\n\n\n\n\n\n\nIf you would like to join the ASG// clan, visit our website at:\nwww.asg-racing.co.cc\n\nPlease do not ask us if you can join ingame.")
- elseif (stage == 4) then -- Last continue click
- stage = 5
- guiSetText(lblWelcomeText,"\n\n\n\n\n\n\n\n\n\nThis concludes the server guide.\n\n\n\nRemember to follow the rules, and you'll have a great time!\n\nIf you have any questions, stop by our website and post it there.\nYou can also send us a Private Message, and we'll try to help you the best we can.\n\n\n\nRegards,\nThe ASG// Clan")
- guiSetText(lblWelcomeToXSS,"Welcome to our server")
- guiSetText(btnContinue,"Start playing!")
- end
- end
- function checkForFirstTimeJoined()
- callServerFunction("checkForFirstTimeJoined",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),checkForFirstTimeJoined)
- -- Level up button
- function triggerLevelUp()
- callServerFunction("newLevelSystem",getLocalPlayer())
- end
- -- Options
- function performSettingsUpdate()
- if recentlySavedSettings == false then
- allowPersonalDetails = tostring(guiCheckBoxGetSelected(checkboxAllowPersonalDetails))
- allowStats = tostring(guiCheckBoxGetSelected(checkboxAllowStats))
- useCustomHorn = tostring(guiCheckBoxGetSelected(checkboxCustomNametag))
- useCustomSkin = tostring(guiCheckBoxGetSelected(checkboxPlayWithCustomSkin))
- useCustomVehicleColor = tostring(guiCheckBoxGetSelected(checkboxPlayWithCustomVehicleColor))
- soundMessage = tostring(guiCheckBoxGetSelected(checkboxSoundMessage)) -- client
- soundRequest = tostring(guiCheckBoxGetSelected(checkboxSoundRequest)) -- client
- showOnDeath = tostring(guiCheckBoxGetSelected(checkboxShowOnDeath)) -- client
- useHunterSkin = tostring(guiCheckBoxGetSelected(checkboxHunterSkin)) -- client
- if guiRadioButtonGetSelected(radioChatManual) == true then
- callServerFunction("saveClientSettings",getLocalPlayer(),allowPersonalDetails,allowStats,useCustomHorn,useCustomSkin,useCustomVehicleColor,soundMessage,soundRequest,showOnDeath,useHunterSkin,"1")
- acceptMode = 1
- elseif guiRadioButtonGetSelected(radioChatAccept) == true then
- callServerFunction("saveClientSettings",getLocalPlayer(),allowPersonalDetails,allowStats,useCustomHorn,useCustomSkin,useCustomVehicleColor,soundMessage,soundRequest,showOnDeath,useHunterSkin,"2")
- acceptMode = 2
- elseif guiRadioButtonGetSelected(radioChatDecline) == true then
- callServerFunction("saveClientSettings",getLocalPlayer(),allowPersonalDetails,allowStats,useCustomHorn,useCustomSkin,useCustomVehicleColor,soundMessage,soundRequest,showOnDeath,useHunterSkin,"3")
- acceptMode = 3
- end
- if useHunterSkin == "true" then
- useHunterSkin = true
- hunterReplace()
- end
- recentlySavedSettings = true
- setTimer(function()
- recentlySavedSettings = false
- end,5000,1)
- else
- outputChatBox("#FF0000* #FFFFFFYou have to wait 5 seconds before you can save your settings again!",255,255,255,true)
- end
- end
- function configureOptions(mode,a,b,c,d,e,f,g,h,i,j)
- if (mode) then
- if (mode == true) then
- -- Select the correct options
- if a == "true" then
- guiCheckBoxSetSelected(checkboxAllowPersonalDetails,true)
- elseif a == "false" then
- guiCheckBoxSetSelected(checkboxAllowPersonalDetails,false)
- end
- if b == "true" then
- guiCheckBoxSetSelected(checkboxAllowStats,true)
- elseif b == "false" then
- guiCheckBoxSetSelected(checkboxAllowStats,false)
- end
- if c == "true" then
- guiCheckBoxSetSelected(checkboxCustomNametag,true)
- elseif c == "false" then
- guiCheckBoxSetSelected(checkboxCustomNametag,false)
- end
- if d == "true" then
- guiCheckBoxSetSelected(checkboxPlayWithCustomSkin,true)
- elseif d == "false" then
- guiCheckBoxSetSelected(checkboxPlayWithCustomSkin,false)
- end
- if e == "true" then
- guiCheckBoxSetSelected(checkboxPlayWithCustomVehicleColor,true)
- elseif e == "false" then
- guiCheckBoxSetSelected(checkboxPlayWithCustomVehicleColor,false)
- end
- if f == "true" then
- guiCheckBoxSetSelected(checkboxSoundMessage,true)
- soundMessage = true
- elseif f == "false" then
- guiCheckBoxSetSelected(checkboxSoundMessage,false)
- soundMessage = false
- end
- if g == "true" then
- guiCheckBoxSetSelected(checkboxSoundRequest,true)
- soundRequest = true
- elseif g == "false" then
- guiCheckBoxSetSelected(checkboxSoundRequest,false)
- soundRequest = false
- end
- if h == "true" then
- guiCheckBoxSetSelected(checkboxShowOnDeath,true)
- showOnDeath = true
- elseif h == "false" then
- guiCheckBoxSetSelected(checkboxShowOnDeath,false)
- showOnDeath = false
- end
- if i == "true" then
- guiCheckBoxSetSelected(checkboxHunterSkin,true)
- useHunterSkin = true
- hunterReplace()
- elseif i == "false" then
- guiCheckBoxSetSelected(checkboxHunterSkin,false)
- useHunterSkin = false
- end
- if j == 1 then
- guiRadioButtonSetSelected(radioChatManual,true)
- acceptMode = 1
- elseif j == 2 then
- guiRadioButtonSetSelected(radioChatAccept,true)
- acceptMode = 2
- elseif j == 3 then
- guiRadioButtonSetSelected(radioChatDecline,true)
- acceptMode = 3
- end
- else
- callServerFunction("getClientSettings",getLocalPlayer())
- end
- end
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),configureOptions)
- -- Chat
- function clearClientChat()
- if playerIsChatting == true then
- guiSetText(memoPlayerChat,"")
- outputChatBox("#FF6600* #FFFFFFChat cleared!",255,255,255,true)
- else
- outputChatBox("#FF6600* #FFFFFFERROR! You are not in a chat!",255,255,255,true)
- end
- end
- function playerChatHandler()
- local messageToSend = guiGetText(editInputChatText)
- if playerIsChatting == true then
- if not (messageToSend == "") then
- callServerFunction("playerChatHandler",getLocalPlayer(),getElementData(getLocalPlayer(),"chattingWith"),messageToSend)
- else
- outputChatBox("#FF6600* #FFFFFFERROR! Please write a message to send!",255,255,255,true)
- return false
- end
- else
- outputChatBox("#FF6600* #FFFFFFERROR! You are not chatting with anybody! Please start a chat first!",255,255,255,true)
- end
- end
- function addPlayerChatText(sendingPlayer,message)
- guiSetText(memoPlayerChat,guiGetText(memoPlayerChat).."* "..sendingPlayer..": "..message)
- guiSetProperty(memoPlayerChat,"CaratIndex",tostring(string.len(guiGetText(memoPlayerChat))))
- if guiGetVisible(tabs[2]) == false then
- guiStaticImageLoadImage(chatStatusImage,"img/newmessage.png")
- if soundMessage == true then
- newMessage = playSound("sounds/newmsg.wav")
- end
- newMessageArrived = true
- end
- end
- function resetInputField()
- guiSetText(editInputChatText,"")
- end
- function toggleChatMode()
- if (guiGetText(btnChatAIO) == "Chat with player") then
- local row,column = guiGridListGetSelectedItem(gridOnlinePlayers)
- local playerName = guiGridListGetItemText(gridOnlinePlayers,row,1)
- if not (playerName == "") then
- if not (getLocalPlayer() == findPlayerByName(playerName)) then
- if not (chatRequestMode == true) and not (chatNotificationMode == true) then
- callServerFunction("chatModeHandler",getLocalPlayer(),findPlayerByName(playerName))
- else
- outputChatBox("#FF6600* #FFFFFFERROR! You cannot perform this action at the moment!",255,255,255,true)
- end
- else
- outputChatBox("#FF6600* #FFFFFFERROR! You cannot chat with yourself!",255,255,255,true)
- return false
- end
- else
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a player!",255,255,255,true)
- return false
- end
- elseif (guiGetText(btnChatAIO) == "Stop chatting") then
- callServerFunction("chatModeHandler",getLocalPlayer(),getElementData(getLocalPlayer(),"chattingWith"))
- end
- end
- function setChatMode(mode,playerName)
- if (mode == 1) then
- playerIsChatting = true
- setElementData(getLocalPlayer(),"chattingWith",playerName)
- guiSetText(btnChatAIO,"Stop chatting")
- guiSetText(lblChattingWith,string.gsub(getPlayerName(playerName),"#%x%x%x%x%x%x", ""))
- guiLabelSetColor(lblChattingWith,0,255,0)
- outputChatBox("#FF6600* #FFFFFFChat started with "..getPlayerName(playerName).."#FFFFFF!",255,255,255,true)
- callServerFunction("achievement29",playerName)
- elseif (mode == 0) then
- playerIsChatting = false
- setElementData(getLocalPlayer(),"chattingWith","none")
- guiSetText(btnChatAIO,"Chat with player")
- guiSetText(lblChattingWith,"Nobody")
- guiLabelSetColor(lblChattingWith,255,0,0)
- outputChatBox("#FF6600* #FFFFFFThe chat with player "..getPlayerName(playerName).."#FFFFFF has ended!",255,255,255,true)
- end
- end
- function acceptChatInvitation()
- if chatNotificationMode == true then
- callServerFunction("acceptChatInvite",chatRequestedBy,getLocalPlayer())
- end
- end
- function declineChatInvitation()
- if chatNotificationMode == true then
- callServerFunction("declineChatInvite",chatRequestedBy,getLocalPlayer())
- end
- end
- function cancelChatInvitation()
- if chatRequestMode == true then
- callServerFunction("cancelChatInvite",chatRequestedBy,getLocalPlayer())
- end
- end
- function setNotInChat()
- setElementData(getLocalPlayer(),"isPlayerInChat",false)
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),setNotInChat)
- function setBusyStatus(kCtrlState)
- if kCtrlState == 1 then playerIsBusy = true end
- if kCtrlState == 2 then playerIsBusy = false end
- end
- function showChatWindows(windowMode,requestingPlayer,targetPlayer)
- if windowMode == 1 then
- if playerIsBusy == false then
- if chatNotificationMode == false then
- chatNotificationMode = true
- chatRequestedBy = requestingPlayer
- if acceptMode == 1 then
- guiSetText(lblChatRequestInformation,string.gsub(getPlayerName(requestingPlayer),"#%x%x%x%x%x%x", "").." would like to chat with you!")
- if guiGetVisible(tabs[2]) == true then
- guiSetVisible(chatRequestNotificationWindow,true)
- guiBringToFront(chatRequestNotificationWindow)
- else
- guiStaticImageLoadImage(chatStatusImage,"img/newchatrequest.png")
- if soundRequest == true then
- newRequest = playSound("sounds/newrequest.wav")
- setSoundVolume(newRequest,1.3)
- end
- end
- setTimer(function()
- playerIsBusy = true
- end,200,1)
- elseif acceptMode == 2 then
- callServerFunction("acceptChatInvite",chatRequestedBy,getLocalPlayer())
- elseif acceptMode == 3 then
- callServerFunction("declineChatInvite",chatRequestedBy,getLocalPlayer())
- end
- else
- guiSetVisible(chatRequestNotificationWindow,false)
- guiStaticImageLoadImage(chatStatusImage,"img/empty.png")
- chatNotificationMode = false
- chatRequestedBy = "none"
- playerIsBusy = false
- end
- else
- end
- elseif windowMode == 2 then
- if playerIsBusy == false then
- if chatRequestMode == false then
- guiSetText(lblRequestChatAccept,"Waiting for "..string.gsub(getPlayerName(targetPlayer),"#%x%x%x%x%x%x", "").." to accept...")
- guiSetVisible(chatRequestingWindow,true)
- guiBringToFront(chatRequestingWindow)
- chatRequestMode = true
- chatRequestedBy = targetPlayer
- setTimer(function()
- playerIsBusy = true
- end,200,1)
- else
- guiSetVisible(chatRequestingWindow,false)
- guiStaticImageLoadImage(chatStatusImage,"img/empty.png")
- chatRequestMode = false
- chatRequestedBy = "none"
- playerIsBusy = false
- end
- else
- callServerFunction("chatErrorResponse",1,requestingPlayer,getLocalPlayer())
- end
- end
- end
- function quitChatHandler(leavingPlayer,reason)
- if chatRequestMode == true and chatRequestedBy == leavingPlayer then
- setElementData(getLocalPlayer(),"isPlayerInChat",false)
- setElementData(getLocalPlayer(),"chattingWith","none")
- showChatWindows(2,getLocalPlayer(),leavingPlayer)
- outputChatBox("#FF6600* #FFFFFFChat request cancelled! "..getPlayerName(leavingPlayer).."#FFFFFF has left the game. #FF6600[#FFFFFF"..reason.."#FF6600]",255,255,255,true)
- end
- if (leavingPlayer == getElementData(getLocalPlayer(),"chattingWith")) then
- setElementData(getLocalPlayer(),"isPlayerInChat",false)
- setElementData(getLocalPlayer(),"chattingWith","none")
- guiSetVisible(chatRequestingWindow,false)
- guiSetVisible(chatRequestNotificationWindow,false)
- chatRequestMode = false
- chatNotificationMode = false
- playerIsBusy = false
- chatRequestedBy = "none"
- guiSetText(lblChattingWith,"Nobody")
- guiLabelSetColor(lblChattingWith,255,0,0)
- guiSetText(btnChatAIO,"Chat with player")
- outputChatBox("#FF6600* #FFFFFFThe chat with player "..getPlayerName(leavingPlayer).."#FFFFFF has ended! #FF6600[#FFFFFF"..reason.."#FF6600]",255,255,255,true)
- guiStaticImageLoadImage(chatStatusImage,"img/empty.png")
- end
- end
- -- Get all maps on server
- function getMaps()
- totalServerMaps = 0
- totalDmMaps = 0
- totalDdMaps = 0
- setTimer(callServerFunction,500,1,"getServerMaps",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getMaps)
- function loadMaps(gamemodeMapTable, gamemode, map)
- guiGridListClear(gridMaps)
- 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
- local row = guiGridListAddRow ( gridMaps )
- guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false )
- guiGridListSetItemData ( gridMaps, row, 1, map.resname)
- totalServerMaps = totalServerMaps+1
- if (string.find(map.name,"[DM]",1,true)) then
- totalDmMaps = totalDmMaps+1
- elseif (string.find(map.name,"[DD]",1,true)) then
- totalDdMaps = totalDdMaps+1
- end
- updateMapLabels(1)
- end
- end
- end
- end
- end
- -- Map search
- function mapSearch()
- guiGridListClear(gridMaps)
- local searchString = string.lower(guiGetText(editMapSearch))
- if ( searchString == "" ) then
- for id,gamemode in pairs (aGamemodeMapTable) do
- if (gamemode.name == "Race") then
- for id,map in ipairs (gamemode.maps) do
- local row = guiGridListAddRow ( gridMaps )
- guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false )
- guiGridListSetItemData ( gridMaps, row, 1, map.resname)
- end
- end
- end
- else
- for id,gamemode in pairs (aGamemodeMapTable) do
- if (gamemode.name == "Race") then
- local noMapsFound = true
- for id,map in ipairs (gamemode.maps) do
- if string.find(string.lower(map.name.." "..map.resname), searchString, 1, true) then
- local row = guiGridListAddRow ( gridMaps )
- guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false )
- guiGridListSetItemData ( gridMaps, row, 1, map.resname)
- noMapsFound = false
- end
- end
- if noMapsFound == true then
- local row = guiGridListAddRow(gridMaps)
- guiGridListSetItemText (gridMaps, row, 1, "No maps matching your search query!", false, false)
- guiGridListSetItemColor (gridMaps, row, 1, 255,50,50)
- end
- end
- end
- end
- updateMapLabels(2)
- end
- function buyNextMap()
- local row,column = guiGridListGetSelectedItem(gridMaps)
- local mapName = guiGridListGetItemText(gridMaps,row,1)
- triggerServerEvent("buyMapFromPanel", getLocalPlayer(), mapName)
- end
- -- Update labels
- function updateMapLabels(updateMode)
- if updateMode == 1 then
- guiSetText(lblTotalMapsOnServer,"Total maps on the server: "..totalServerMaps)
- guiSetText(lblTotalDmMaps,"Total DM Maps: "..totalDmMaps)
- guiSetText(lblTotalDdMaps,"Total DD Maps: "..totalDdMaps)
- else
- local row,column = guiGridListGetSelectedItem(gridMaps)
- local mapName = guiGridListGetItemText(gridMaps,row,1)
- if mapName == "" then
- guiSetText(lblSelectedMapName,"N/A")
- guiSetText(lblSelectedMapAuthor,"N/A")
- else
- guiSetText(lblSelectedMapName,mapName)
- if string.find(mapName,"[DM]",1,true) then
- guiSetText(lblSelectedMapAuthor,"Deathmatch")
- elseif string.find(mapName,"[DD]",1,true) then
- guiSetText(lblSelectedMapAuthor,"Destruction Derby")
- elseif string.find(mapName,"[FUN]",1,true) then
- guiSetText(lblSelectedMapAuthor,"Fun map")
- else
- guiSetText(lblSelectedMapAuthor,"UNKNOWN")
- end
- end
- end
- end
- -- Skins
- function openSkinsWindowCheck()
- callServerFunction("checkSkinLevel",getLocalPlayer())
- end
- function openSkinsWindow()
- guiSetVisible(skinsWindow,true)
- guiSetVisible(tabs[4],false)
- guiBringToFront(skinsWindow)
- end
- function closeSkinsWindow()
- guiSetVisible(skinsWindow,false)
- guiSetVisible(tabs[4],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 PickMode == "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",getRootElement(),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",getRootElement(),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
- -- Reaction test console check
- function checkForOpenConsole(message,type)
- local isOpen = isConsoleActive()
- callServerFunction("checkReactionTest",getLocalPlayer(),message,type,isOpen)
- end
- ------------------------------------------------
- -- Stats refresing and other userpanel functions
- ------------------------------------------------
- function refreshStats(levelDisplay,levelImage,playerCash,unlockedAchievements,totalTimesJoined,mapsWon,mapsPlayed,winRatio,totalHunters,totalToptimes,totalMoneyEarned,totalMoneySent,totalBets,totalBetsEarned,totalBetsWon,totalDeaths,totalPlayingTimeMinutes,totalPlayingTimeHours,totalReactionTests,bestReactionTime)
- guiSetText (lblPlayerLevel, "Level: "..levelDisplay)
- guiSetText (lblPlayerMoney, "Money: $"..playerCash)
- guiSetText (lblAchievementsUnlocked, "Achievements unlocked: "..unlockedAchievements.."/40")
- guiSetText (lblAchievementsUnlockedTab, "Achievements unlocked: "..unlockedAchievements.."/40")
- guiSetText (lblPlayerLevelRank, "Level "..levelDisplay)
- guiSetText (lblMapsWon,"Maps won: "..mapsWon)
- guiSetText (lblTotalMapsPlayed,"Total maps played: "..mapsPlayed)
- guiSetText (lblWinRatio,"Map win ratio: "..winRatio.."%")
- guiSetText (lblTimesJoined,"Times joined the server: "..totalTimesJoined)
- guiSetText (lblTotalHunters,"Total hunters reached: "..totalHunters)
- guiSetText (lblTotalToptimes,"Total toptimes set: "..totalToptimes)
- guiSetText (lblTotalMoney,"Total money earned: $"..totalMoneyEarned)
- guiSetText (lblSentMoney,"Money sent to players: $"..totalMoneySent)
- guiSetText (lblTotalDeaths,"Total deaths: "..totalDeaths)
- guiSetText (lblTotalBets,"Total bets: "..totalBets)
- guiSetText (lblBetsWon,"Bets won: "..totalBetsWon)
- guiSetText (lblMoneyEarnBet,"Money earned with betting: $"..totalBetsEarned)
- guiSetText (lblTotalReactionTests,"Reaction tests won: "..totalReactionTests)
- guiSetText (tabs[1],"Your stats")
- guiStaticImageLoadImage (imageLevel,levelImage)
- if totalPlayingTimeMinutes < 10 then
- guiSetText (lblTotalPlayingTime,"Total playing time: "..totalPlayingTimeHours..":0"..totalPlayingTimeMinutes)
- else
- guiSetText (lblTotalPlayingTime,"Total playing time: "..totalPlayingTimeHours..":"..totalPlayingTimeMinutes)
- end
- if bestReactionTime == 0 then
- guiSetText (lblBestReactionTime,"Best reaction time: N/A")
- else
- guiSetText (lblBestReactionTime,"Best reaction time: "..bestReactionTime)
- end
- local row = 0
- for detail,detailName in pairs(details) do
- guiGridListSetItemData(gridAchievements,row,1,detailName)
- row = row+1
- end
- end
- function refreshTimePlaying(totalPlayingTimeMinutes,totalPlayingTimeHours)
- if totalPlayingTimeMinutes < 10 then
- guiSetText (lblTotalPlayingTime,"Total playing time: "..totalPlayingTimeHours..":0"..totalPlayingTimeMinutes)
- else
- guiSetText (lblTotalPlayingTime,"Total playing time: "..totalPlayingTimeHours..":"..totalPlayingTimeMinutes)
- end
- end
- function triggerScoreboardRefresh()
- callServerFunction("scoreboardRefresh",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),triggerScoreboardRefresh)
- function playingTimeTimer()
- addTime = setTimer(playingTimeTimerTrigger,60000,0)
- end
- function playingTimeTimerTrigger()
- callServerFunction("playingTimeAdd",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),playingTimeTimer)
- function playingTimeTimerStop()
- killTimer(addTime)
- end
- addEventHandler("onClientResourceStop",getResourceRootElement(getThisResource()),playingTimeTimerStop)
- function setProgressBar(progressBarValue)
- guiProgressBarSetProgress(progressLevel,progressBarValue)
- end
- function updateProgressBar(progressBarValue)
- guiProgressBarSetProgress(progressLevel,progressBarValue)
- end
- function triggerProgressBarOnStart()
- callServerFunction("progressBarUpdate",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),triggerProgressBarOnStart)
- function togglePersonalDetailsWindow()
- local visible = guiGetVisible(personalDetailsWindow)
- if visible == false then
- guiEditSetReadOnly(pDetailsName,false)
- guiEditSetReadOnly(pDetailsAge,false)
- guiEditSetReadOnly(pDetailsEmail,false)
- guiEditSetReadOnly(pDetailsMsn,false)
- guiEditSetReadOnly(pDetailsSkype,false)
- guiEditSetReadOnly(pDetailsXfire,false)
- guiEditSetReadOnly(pDetailsICQ,false)
- guiEditSetReadOnly(pDetailsXBL,false)
- guiSetVisible(personalDetailsWindow,true)
- guiBringToFront(personalDetailsWindow)
- end
- end
- function closePersonalDetailsWindow()
- if (guiGetText(buttonPersonalDetailsSave) == "Save") then
- guiSetVisible(personalDetailsWindow,false)
- callServerFunction("savePersonalDetails",getLocalPlayer(),guiGetText(pDetailsName),guiGetText(pDetailsAge),guiGetText(pDetailsEmail),guiGetText(pDetailsMsn),guiGetText(pDetailsSkype),guiGetText(pDetailsXfire),guiGetText(pDetailsICQ),guiGetText(pDetailsXBL))
- else
- guiSetVisible(personalDetailsWindow,false)
- guiSetText(buttonPersonalDetailsSave,"Save")
- end
- end
- function refreshConnectedPlayers()
- guiGridListClear(gridOnlinePlayers)
- for _,player in ipairs(getElementsByType("player")) do
- local row = guiGridListAddRow (gridOnlinePlayers)
- guiGridListSetItemText(gridOnlinePlayers,row,1,string.gsub(getPlayerName(player),"#%x%x%x%x%x%x", ""),false,false)
- end
- if playerIsChatting == true then
- guiSetText(lblChattingWith,string.gsub(getPlayerName(getElementData(getLocalPlayer(),"chattingWith")),"#%x%x%x%x%x%x", ""))
- end
- end
- function giveMoney()
- local row,column = guiGridListGetSelectedItem(gridOnlinePlayers)
- local playerName = guiGridListGetItemText(gridOnlinePlayers,row,1)
- local amount = guiGetText(editAmountToSend)
- callServerFunction("giveMoney",getLocalPlayer(),playerName,amount)
- end
- function getDataOnStart()
- callServerFunction("getDataOnStart",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getDataOnStart)
- function setDataOnStart(pName,pAge,pEmail,pMsn,pSkype,pXFire,pIcq,pXbl)
- if not (pName == 0) then guiSetText(pDetailsName,pName) end
- if not (pAge == 0) then guiSetText(pDetailsAge,pAge) end
- if not (pEmail == 0) then guiSetText(pDetailsEmail,pEmail) end
- if not (pMsn == 0) then guiSetText(pDetailsMsn,pMsn) end
- if not (pSkype == 0) then guiSetText(pDetailsSkype,pSkype) end
- if not (pXFire == 0) then guiSetText(pDetailsXfire,pXFire) end
- if not (pIcq == 0) then guiSetText(pDetailsICQ,pIcq) end
- if not (pXbl == 0) then guiSetText(pDetailsXBL,pXbl) end
- end
- function displayPersonalDetailsCall()
- local row,column = guiGridListGetSelectedItem(gridOnlinePlayers)
- local playerName = guiGridListGetItemText(gridOnlinePlayers,row,1)
- if not (playerName == "") then
- callServerFunction("getPersonalDetails",getLocalPlayer(),playerName)
- else
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a player!",255,255,255,true)
- end
- end
- function displayPersonalDetails(pName,pAge,pEmail,pMsn,pSkype,pXFire,pIcq,pXbl)
- if (pName == 0) then
- guiSetText(pDetailsName," ")
- else
- guiSetText(pDetailsName,pName)
- end
- if (pAge == 0) then
- guiSetText(pDetailsAge," ")
- else
- guiSetText(pDetailsAge,pAge)
- end
- if (pEmail == 0) then
- guiSetText(pDetailsEmail," ")
- else
- guiSetText(pDetailsEmail,pEmail)
- end
- if (pMsn == 0) then
- guiSetText(pDetailsMsn," ")
- else
- guiSetText(pDetailsMsn,pMsn)
- end
- if (pSkype == 0) then
- guiSetText(pDetailsSkype," ")
- else
- guiSetText(pDetailsSkype,pSkype)
- end
- if (pXFire == 0) then
- guiSetText(pDetailsXfire," ")
- else
- guiSetText(pDetailsXfire,pXFire)
- end
- if (pIcq == 0) then
- guiSetText(pDetailsICQ," ")
- else
- guiSetText(pDetailsICQ,pIcq)
- end
- if (pXbl == 0) then
- guiSetText(pDetailsXBL," ")
- else
- guiSetText(pDetailsXBL,pXbl)
- end
- guiEditSetReadOnly(pDetailsName,true)
- guiEditSetReadOnly(pDetailsAge,true)
- guiEditSetReadOnly(pDetailsEmail,true)
- guiEditSetReadOnly(pDetailsMsn,true)
- guiEditSetReadOnly(pDetailsSkype,true)
- guiEditSetReadOnly(pDetailsXfire,true)
- guiEditSetReadOnly(pDetailsICQ,true)
- guiEditSetReadOnly(pDetailsXBL,true)
- guiSetText(buttonPersonalDetailsSave,"Close")
- guiSetVisible(personalDetailsWindow,true)
- guiBringToFront(personalDetailsWindow)
- end
- function getPersonalStats()
- local row,column = guiGridListGetSelectedItem(gridOnlinePlayers)
- local playerName = guiGridListGetItemText(gridOnlinePlayers,row,1)
- if not (playerName == "") then
- callServerFunction("getPlayerStats",getLocalPlayer(),findPlayerByName(playerName))
- else
- outputChatBox("#FF6600* #FFFFFFERROR! Please select a player!",255,255,255,true)
- end
- end
- function displayPersonalStats(thePlayer,levelDisplay,levelImage,playerCash,unlockedAchievements,totalTimesJoined,mapsWon,mapsPlayed,winRatio,totalHunters,totalToptimes,totalMoneyEarned,totalMoneySent,totalBets,totalBetsEarned,totalBetsWon,totalDeaths,totalPlayingTimeMinutes,totalPlayingTimeHours,totalReactionTests,bestReactionTime)
- guiSetText (lblPLevel, "Level: "..levelDisplay)
- guiSetText (lblPMoney, "Money: $"..playerCash)
- guiSetText (lblPAchievementsUnlocked, "Achievements unlocked: "..unlockedAchievements.."/40")
- guiSetText (lblPLevel2, "Level "..levelDisplay)
- guiSetText (lblPMapsWon,"Maps won: "..mapsWon)
- guiSetText (lblPTotalMapsPlayed,"Total maps played: "..mapsPlayed)
- guiSetText (lblPWinRatio,"Map win ratio: "..winRatio.."%")
- guiSetText (lblPTimesJoined,"Times joined the server: "..totalTimesJoined)
- guiSetText (lblPTotalHunters,"Total hunters reached: "..totalHunters)
- guiSetText (lblPTotalToptimes,"Total toptimes set: "..totalToptimes)
- guiSetText (lblPTotalMoneyEarned,"Total money earned: $"..totalMoneyEarned)
- guiSetText (lblPMoneySent,"Money sent to players: $"..totalMoneySent)
- guiSetText (lblPTotalDeaths,"Total deaths: "..totalDeaths)
- guiSetText (lblPTotalBets,"Total bets: "..totalBets)
- guiSetText (lblPBetsWon,"Bets won: "..totalBetsWon)
- guiSetText (lblPMoneyBetEarned,"Money earned with betting: $"..totalBetsEarned)
- guiSetText (lblPTotalReactionTests,"Reaction tests won: "..totalReactionTests)
- guiStaticImageLoadImage (pImageLevel,levelImage)
- if totalPlayingTimeMinutes < 10 then
- guiSetText (lblPTotalPlayingTime,"Total playing time: "..totalPlayingTimeHours..":0"..totalPlayingTimeMinutes)
- else
- guiSetText (lblPTotalPlayingTime,"Total playing time: "..totalPlayingTimeHours..":"..totalPlayingTimeMinutes)
- end
- if bestReactionTime == 0 or bestReactionTime == "" then
- guiSetText (lblPBestReactionTime,"Best reaction time: N/A")
- else
- guiSetText (lblPBestReactionTime,"Best reaction time: "..bestReactionTime)
- end
- guiSetText(playerStatsWindow,string.gsub(getPlayerName(thePlayer),"#%x%x%x%x%x%x", "").."'s stats")
- guiSetVisible(playerStatsWindow,true)
- guiBringToFront(playerStatsWindow)
- end
- function closeStatsWindow()
- guiSetVisible(playerStatsWindow,false)
- end
- ---------------
- -- Achievements
- ---------------
- -- Fancy achievement FX
- local sx,sy = guiGetScreenSize()
- local gMe = getLocalPlayer()
- local achievement = {}
- addEventHandler("onClientResourceStart",resourceRoot,function()
- achievement.width = 400
- achievement.queue = {}
- achievement.left = "left.png"
- achievement.left_image = "left_1.png"
- achievement.left_fade = 255
- achievement.right = "right.png"
- achievement.background = "background.png"
- end)
- function showAchievement(locked,text,worth)
- achievementActive = 1
- achievement.text = text
- achievement.worth = tostring(worth)
- achievement.background = "background.png"
- achievement.locked = locked
- achievement.active = true
- achievement.width = dxGetTextWidth((achievement.locked == true and "Achievement Locked" or "Achievement Unlocked"),2,"default-bold")
- achievement.fade = 0
- achievement.step = 10
- achievement.left_fade = 0
- achievement.left_step = 10
- if dxGetTextWidth(tostring(worth) .. "X - " .. text,2,"default-bold") > achievement.width then -- Check for width with the 'X' points, even though they're disabled (might add them later)
- if dxGetTextWidth(tostring(worth) .. "X - " .. text,2,"default-bold") <= 500 then
- achievement.width = dxGetTextWidth(tostring(worth) .. "X - " .. text,2,"default-bold")
- else
- achievement.width = 500
- end
- end
- playSound("sounds/achievement.mp3",false)
- achievement.width = achievement.width + 10
- addEventHandler("onClientRender",root,drawAchievement)
- achievement.swap = setTimer(function()
- achievement.left_step = achievement.left_step > 0 and -40 or 40
- end,2000,0)
- achievement.timer = setTimer(function()
- achievement.step = -10
- achievement.left_step = -10
- achievement.left_fade = achievement.fade
- end,7000,1)
- end
- addEvent("showClientAchievement",true)
- addEventHandler("showClientAchievement",root,showAchievement)
- function drawAchievement()
- local alpha = fade(achievement.fade,achievement.step)
- if alpha == 0 and achievement.fade > alpha then
- removeAchievement()
- end
- achievement.fade = alpha
- if achievement.fade == 255 then
- dxDrawImage((sx/2)-(achievement.width/2)-63,sy-200,64,64,"img/"..achievement.left,0,0,0,tocolor(255,255,255,achievement.fade))
- end
- dxDrawImage((sx/2)+(achievement.width/2)-1,sy-200,64,64,"img/"..achievement.right,0,0,0,tocolor(255,255,255,achievement.fade))
- alpha = fade(achievement.left_fade,achievement.left_step)
- if alpha == 0 and achievement.left_fade > alpha then
- achievement.left_image = achievement.left_image == "left_1.png" and "left_2.png" or "left_1.png"
- achievement.left_step = 40
- end
- achievement.left_fade = alpha
- dxDrawImage((sx/2)-(achievement.width/2)-63,sy-200,64,64,"img/"..achievement.left_image,0,0,0,tocolor(255,255,255,achievement.left_fade))
- dxDrawImage((sx/2)-(achievement.width/2),sy-200,achievement.width,64,"img/"..achievement.background,0,0,0,tocolor(255,255,255,achievement.fade))
- dxDrawText((achievement.locked == true and "Achievement Locked" or "Achievement Unlocked") .. "\n"--[[ .. achievement.worth .. "X - " -]].. achievement.text,
- (sx/2)-(achievement.width/2),
- sy-200,
- (sx/2)+(achievement.width/2),
- sy-136,
- tocolor(255,255,255,achievement.fade),
- 2,
- "default-bold",
- "center",
- "top",
- true,
- true)
- end
- function fade(value,step)
- if step > 0 then
- if value < 255 then
- value = value + step
- if value > 255 then
- value = 255
- end
- end
- else
- if value > 0 then
- value = value + step
- if value <= 0 then
- value = 0
- end
- end
- end
- return value
- end
- function removeAchievement()
- if achievement.swap and isTimer(achievement.swap) then killTimer(achievement.swap) end
- if achievement.timer and isTimer(achievement.timer) then killTimer(achievement.timer) end
- removeEventHandler("onClientRender",root,drawAchievement)
- achievement.active = false
- if achievement.queue then
- if achievement.queue[1] then
- showAchievement(achievement.queue[1][1],achievement.queue[1][2],achievement.queue[1][3])
- table.remove(achievement.queue,1)
- end
- end
- achievementActive = 0
- end
- -- The actual achievements recording
- function checkAchievementsOnStart(ach1,ach2,ach3,ach4,ach5,ach6,ach7,ach8,ach9,ach10,ach11,ach12,ach13,ach14,ach15,ach16,ach17,ach18,ach19,ach20,ach21,ach22,ach23,ach24,ach25,ach26,ach27,ach28,ach29,ach30,ach31,ach32,ach33,ach34,ach35,ach36,ach37,ach38,ach39,ach40)
- if ach1 == 1 then setAchievementText(1) end
- if ach2 == 1 then setAchievementText(2) end
- if ach3 == 1 then setAchievementText(3) end
- if ach4 == 1 then setAchievementText(4) end
- if ach5 == 1 then setAchievementText(5) end
- if ach6 == 1 then setAchievementText(6) end
- if ach7 == 1 then setAchievementText(7) end
- if ach8 == 1 then setAchievementText(8) end
- if ach9 == 1 then setAchievementText(9) end
- if ach10 == 1 then setAchievementText(10) end
- if ach11 == 1 then setAchievementText(11) end
- if ach12 == 1 then setAchievementText(12) end
- if ach13 == 1 then setAchievementText(13) end
- if ach14 == 1 then setAchievementText(14) end
- if ach15 == 1 then setAchievementText(15) end
- if ach16 == 1 then setAchievementText(16) end
- if ach17 == 1 then setAchievementText(17) end
- if ach18 == 1 then setAchievementText(18) end
- if ach19 == 1 then setAchievementText(19) end
- if ach20 == 1 then setAchievementText(20) end
- if ach21 == 1 then setAchievementText(21) end
- if ach22 == 1 then setAchievementText(22) end
- if ach23 == 1 then setAchievementText(23) end
- if ach24 == 1 then setAchievementText(24) end
- if ach25 == 1 then setAchievementText(25) end
- if ach26 == 1 then setAchievementText(26) end
- if ach27 == 1 then setAchievementText(27) end
- if ach28 == 1 then setAchievementText(28) end
- if ach29 == 1 then setAchievementText(29) end
- if ach30 == 1 then setAchievementText(30) end
- if ach31 == 1 then setAchievementText(31) end
- if ach32 == 1 then setAchievementText(32) end
- if ach33 == 1 then setAchievementText(33) end
- if ach34 == 1 then setAchievementText(34) end
- if ach35 == 1 then setAchievementText(35) end
- if ach36 == 1 then setAchievementText(36) end
- if ach37 == 1 then setAchievementText(37) end
- if ach38 == 1 then setAchievementText(38) end
- if ach39 == 1 then setAchievementText(39) end
- if ach40 == 1 then setAchievementText(40) end
- local achcount = 0
- if ach1 == 1 then achcount = achcount+1 end
- if ach2 == 1 then achcount = achcount+1 end
- if ach3 == 1 then achcount = achcount+1 end
- if ach4 == 1 then achcount = achcount+1 end
- if ach5 == 1 then achcount = achcount+1 end
- if ach6 == 1 then achcount = achcount+1 end
- if ach7 == 1 then achcount = achcount+1 end
- if ach8 == 1 then achcount = achcount+1 end
- if ach9 == 1 then achcount = achcount+1 end
- if ach10 == 1 then achcount = achcount+1 end
- if ach11 == 1 then achcount = achcount+1 end
- if ach12 == 1 then achcount = achcount+1 end
- if ach13 == 1 then achcount = achcount+1 end
- if ach14 == 1 then achcount = achcount+1 end
- if ach15 == 1 then achcount = achcount+1 end
- if ach16 == 1 then achcount = achcount+1 end
- if ach17 == 1 then achcount = achcount+1 end
- if ach18 == 1 then achcount = achcount+1 end
- if ach19 == 1 then achcount = achcount+1 end
- if ach20 == 1 then achcount = achcount+1 end
- if ach21 == 1 then achcount = achcount+1 end
- if ach22 == 1 then achcount = achcount+1 end
- if ach23 == 1 then achcount = achcount+1 end
- if ach24 == 1 then achcount = achcount+1 end
- if ach25 == 1 then achcount = achcount+1 end
- if ach26 == 1 then achcount = achcount+1 end
- if ach27 == 1 then achcount = achcount+1 end
- if ach28 == 1 then achcount = achcount+1 end
- if ach29 == 1 then achcount = achcount+1 end
- if ach30 == 1 then achcount = achcount+1 end
- if ach31 == 1 then achcount = achcount+1 end
- if ach32 == 1 then achcount = achcount+1 end
- if ach33 == 1 then achcount = achcount+1 end
- if ach34 == 1 then achcount = achcount+1 end
- if ach35 == 1 then achcount = achcount+1 end
- if ach36 == 1 then achcount = achcount+1 end
- if ach37 == 1 then achcount = achcount+1 end
- if ach38 == 1 then achcount = achcount+1 end
- if ach39 == 1 then achcount = achcount+1 end
- if ach40 == 1 then achcount = achcount+1 end
- updateUnlockedAchievementsNumberLabel(achcount)
- callServerFunction("unlockedAchievementsSet",getLocalPlayer(),achcount)
- end
- -- Check for unlocked achievements on client resource start and unlock them in the userpanel
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),
- function ()
- callServerFunction("achievement23",getLocalPlayer()) -- Checking for the 23rd achievement
- callServerFunction("checkAchievementsOnStart",getLocalPlayer())
- end)
- function setAchievementText(row)
- guiGridListSetItemText (gridAchievements,row-1,1,achievements[row],false,false)
- guiGridListSetItemColor(gridAchievements,row-1,1,100,255,60,255)
- end
- -- Main function for unlocking achievements
- function unlockAchievement(achievementNumber)
- if achievementActive == 0 then -- If the achievement pop-up is NOT active, unlock the achievement
- local achievementName = achievements[achievementNumber]
- showAchievement(false,achievementName,1)
- guiGridListSetItemText (gridAchievements,achievementNumber-1,1,achievements[achievementNumber],false,false)
- guiGridListSetItemColor(gridAchievements,achievementNumber-1,1,100,255,60,255)
- callServerFunction("displayFancyUnlockText",getLocalPlayer(),achievements[achievementNumber])
- callServerFunction("achievement40",getLocalPlayer())
- else
- achievementTimer(achievementNumber) -- Call a function to check for the achievement pop-up again after 2 seconds
- end
- end
- function achievementTimer(achievementNumber)
- setTimer(unlockAchievement,2000,1,achievementNumber)
- end
- -- Displays the achievement information on the labels
- function updateAchievementDetailsLabel()
- local row,column = guiGridListGetSelectedItem(gridAchievements)
- local checkLocked = guiGridListGetItemText(gridAchievements,row,1)
- if not (checkLocked == " -- Locked --") then
- local achname = achievements[row+1]
- local details = guiGridListGetItemData(gridAchievements,row,1)
- guiSetText(lblAchievementNameText,achname)
- guiSetText(lblUnlockConditionText,details)
- else
- local achnameLocked = "-- Locked --"
- local detailsLocked = "-- Locked --"
- guiSetText(lblAchievementNameText,achnameLocked)
- guiSetText(lblUnlockConditionText,detailsLocked)
- end
- end
- function updateUnlockedAchievementsNumberLabel(unlockedNumber)
- guiSetText(lblAchievementsUnlockedTab,"Achievements unlocked: "..unlockedNumber.."/40")
- guiSetText(lblAchievementsUnlocked,"Achievements unlocked: "..unlockedNumber.."/40")
- end
- -- This part is for the fake unlock command :)
- function fakeUnlock(message)
- showAchievement(false,message,1)
- end
- -----------------------
- -- Display static image
- -----------------------
- function displayLogo()
- guiCreateStaticImage(0.57, 0, 0.43, 0.1333, 'img/url.png', true, nil)
- NavmanPlate = guiCreateStaticImage(0, 0.751666666666, 0.22125, 0.248333333333, 'img/radar.png', false, nil)
- guiMoveToBack( NavmanPlate )
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),displayLogo)
- --------------------------------
- -- Custom hunter model & texture
- --------------------------------
- function hunterReplace()
- if useHunterSkin == true then
- hunterTexture = engineLoadTXD ( "model/hunter.txd" )
- engineImportTXD ( hunterTexture, 425 )
- hunterModel = engineLoadDFF ( "model/hunter.dff", 425 )
- engineReplaceModel ( hunterModel, 425 )
- end
- end
- addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), hunterReplace)
- ------------------------------------------
- -- 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
- -----------------
- -- 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
- ----------------
- -- Fun functions
- ----------------
- function enableFlyCheat(state)
- if state == "true" then
- setWorldSpecialPropertyEnabled("aircars",true)
- else
- setWorldSpecialPropertyEnabled("aircars",false)
- end
- end
- function enableHoverCheat(state)
- if state == "true" then
- setWorldSpecialPropertyEnabled("hovercars",true)
- else
- setWorldSpecialPropertyEnabled("hovercars",false)
- end
- end
- -------------
- -- AFK killer
- -------------
- local MaxAFKtime = 50
- local warnTime = 40
- local v = 0
- local AFKtime = 0
- local sx,sy = guiGetScreenSize()
- local wEvent = false
- function rWarn()
- dxDrawImage( sx/2 - 300, sy/2 - 100, 600, 200, "img/warn.png")
- dxDrawText("You will be killed in "..tostring(tCount).." seconds",sx/2 - 255, sy/2 + 45,sx,sy,tocolor(1,176,240,255),1.01,"bankgothic")
- end
- function stopWarn()
- if(wEvent) then
- removeEventHandler("onClientRender", getRootElement(), rWarn)
- wEvent = false
- end
- end
- function imgHandler()
- stopWarn()
- end
- addEventHandler("onClientPlayerWasted",getLocalPlayer(),imgHandler)
- function checkMain()
- if isPedInVehicle ( getLocalPlayer() ) then
- aTimeAdd()
- end
- end
- function aTimeAdd()
- AFKtime = AFKtime + 1
- local isFinished = getElementData ( getLocalPlayer(), "dead")
- if(isVehicleFrozen ( getPedOccupiedVehicle ( getLocalPlayer() )) and isFinished == false) then
- aTimeClear()
- end
- local isNew = getElementData (getLocalPlayer(), "state")
- if isNew == "waiting" or isNew == "dead" then
- aTimeClear()
- end
- if(getPedOccupiedVehicle ( getLocalPlayer() ) ~= false) then
- local player = getLocalPlayer()
- if(AFKtime >= MaxAFKtime) then
- if (afkCounter <= 2) then
- triggerServerEvent ( "afkWarn", player, 1, afkCounter)
- afkCounter = afkCounter+1
- triggerServerEvent ( "afkSlap", player)
- stopWarn()
- elseif (afkCounter > 2) then
- triggerServerEvent ( "afkWarn", player, 1, afkCounter)
- triggerServerEvent ( "afkWarn", player, 2)
- afkCounter = 1
- triggerServerEvent ( "afkKick", player , player)
- end
- elseif(AFKtime >= warnTime) then
- tCount = tCount - 1
- if(not wEvent) then
- addEventHandler("onClientRender", getRootElement(), rWarn)
- wEvent = true
- end
- end
- end
- end
- setTimer ( checkMain, 1000, -1)
- function aTimeClear()
- AFKtime = 0
- tCount = 11
- stopWarn()
- end
- bindKey("accelerate","down",aTimeClear)
- bindKey("vehicle_left","down",aTimeClear)
- bindKey("vehicle_right","down",aTimeClear)
- bindKey("brake_reverse","down",aTimeClear)
- function onClientLoaded(res)
- triggerServerEvent("onClientLoaded",getLocalPlayer())
- end
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),onClientLoaded)
- function loadSettings(maxtime, wtime )
- MaxAFKtime = tonumber(maxtime)
- warnTime = tonumber(wtime)
- end
- addEvent( "onSettingsReady", true )
- addEventHandler( "onSettingsReady", getRootElement(), loadSettings )
- function setKBA(thePlayer)
- killedByAfk = 1
- end
- function getKBA(thePlayer)
- if killedByAfk == 0 then
- thePlayer = getLocalPlayer()
- callServerFunction("earnMoney", thePlayer)
- end
- end
- function deathReset()
- if killedByAfk == 0 then
- afkCounter = 1
- else
- end
- end
- addEventHandler("onClientPlayerWasted",getLocalPlayer(),deathReset)
- function resetKBA()
- killedByAfk = 0
- end
- ----------------------
- -- Find player by name
- ----------------------
- 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
- -------------------------------------
- -- Set the player's element data call
- -------------------------------------
- addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),
- function ()
- setTimer(callServerFunction,200,1,"setElementDataOnStart",getLocalPlayer())
- end)
- ----------------------
- -- Play various sounds
- ----------------------
- function playWinSound()
- playSound("sounds/win.mp3")
- end
- ------------------------------------------
- -- Script by NeXTreme --
- -- --
- -- --
- -- You've read all of this!? --
- -- --
- ------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment