Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local screenx,screeny=guiGetScreenSize()
- local mainMenuDrawn=true
- function setUpButtons()
- buttonsOver={}
- buttonsDefault={}
- buttonHeight=screeny*0.2
- buttonWidth=screenx*0.25
- buttonsDefault["Classes"]={['x']=0,['y']=screeny*0.6,['w']=buttonWidth,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(200,200,200,255),['scale']=2,['font']="default"}
- buttonsOver["Classes"] ={['x']=0,['y']=screeny*0.6,['w']=buttonWidth*1.25,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(50,200,200,255),['scale']=3,['font']="default"}
- buttonsDefault["Skin"]={['x']=0,['y']=screeny*0.8,['w']=buttonWidth,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(200,200,200,255),['scale']=2,['font']="default"}
- buttonsOver["Skin"] ={['x']=0,['y']=screeny*0.8,['w']=buttonWidth*1.25,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(50,200,200,255),['scale']=3,['font']="default"}
- buttonsDefault["Gang Management"]={['x']=screenx-buttonWidth,['y']=screeny*0.8,['w']=buttonWidth,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(200,200,200,255),['scale']=2,['font']="default"}
- buttonsOver["Gang Management"] ={['x']=screenx-buttonWidth-buttonWidth*0.25,['y']=screeny*0.8,['w']=buttonWidth*1.25,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(50,200,200,255),['scale']=3,['font']="default"}
- buttonsDefault["Button"]={['x']=screenx-buttonWidth,['y']=screeny*0.6,['w']=buttonWidth,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(200,200,200,255),['scale']=2,['font']="default"}
- buttonsOver["Button"] ={['x']=screenx-buttonWidth-buttonWidth*0.25,['y']=screeny*0.6,['w']=buttonWidth*1.25,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(50,200,200,255),['scale']=3,['font']="default"}
- buttonsDefault["Paul is not fat"]={['x']=screenx-buttonWidth,['y']=screeny*0.4,['w']=buttonWidth,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(200,200,200,255),['scale']=2,['font']="default"}
- buttonsOver["Paul is not fat"] ={['x']=screenx-buttonWidth-buttonWidth*0.25,['y']=screeny*0.4,['w']=buttonWidth*1.25,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(50,200,200,255),['scale']=3,['font']="default"}
- buttonsDefault["Stats"]={['x']=screenx-buttonWidth,['y']=screeny*0.2,['w']=buttonWidth,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(200,200,200,255),['scale']=2,['font']="default"}
- buttonsOver["Stats"] ={['x']=screenx-buttonWidth-buttonWidth*0.25,['y']=screeny*0.2,['w']=buttonWidth*1.25,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(50,200,200,255),['scale']=3,['font']="default"}
- buttonsDefault["Leaderboard"]={['x']=screenx-buttonWidth,['y']=0,['w']=buttonWidth,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(200,200,200,255),['scale']=2,['font']="default"}
- buttonsOver["Leaderboard"] ={['x']=screenx-buttonWidth-buttonWidth*0.25,['y']=screeny*0.0,['w']=buttonWidth*1.25,['h']=buttonHeight,['color']=tocolor(100,100,100,100),['textColor']=tocolor(50,200,200,255),['scale']=3,['font']="default"}
- --buttonsDefault[""]={['x']=,['y']=,['w']=,['h']=,['color']=,['textColor']=,['font']=}
- --buttonsOver[""] ={['x']=,['y']=,['w']=,['h']=,['color']=,['textColor']=,['font']=}
- currentButtons=buttonsDefault
- end
- setUpButtons()
- function handleMenu()
- if mainMenuDrawn==true then
- if isCursorShowing()==true then
- local cursorx,cursory=getCursorPosition()
- local cursorx=cursorx*screenx
- local cursory=cursory*screeny
- for buttonName,buttonData in pairs(currentButtons) do
- if cursorx>buttonData['x'] and cursorx<buttonData['x']+buttonData['w'] and cursory>buttonData['y'] and cursory<buttonData['y']+buttonData['h'] then
- currentButtons[buttonName]=buttonsOver[buttonName]
- elseif cursorx<buttonData['x'] or cursorx>buttonData['x']+buttonData['w'] or cursory<buttonData['y'] or cursory>buttonData['y']+buttonData['h'] then
- currentButtons[buttonName]=buttonsDefault[buttonName]
- else
- currentButtons[buttonName]=buttonsDefault[buttonName]
- end
- end
- end
- --drawing
- --dxDrawImage(screenx-300,screeny-300,600,600,"images/map",0,0,0,tocolor(0,0,0),true)
- dxDrawRectangle(0,0,screenx,screeny,tocolor(50,50,50,200))
- for id,data in pairs(currentButtons) do
- dxDrawRectangle(data['x'],data['y'],data['w'],data['h'],data['color'],true)
- dxDrawRectangle(data['x']+5,data['y']+5,data['w']-10,data['h']-10,data['color'],true)
- dxDrawText(id,data['x'],data['y'],data['x']+data['w'],data['y']+data['h'],data['textColor'],data['scale'],data['font'],"center","center",true)
- end
- end
- end
- addEventHandler("onClientRender",getRootElement(),handleMenu)
- function handleClicks()
- if menuDrawn==true then
- end
- end
- addEventHandler("onClientClick",getRootElement(),handleMenu)
- function clickedF1(button,state)
- if state==true and button=="F1" then
- local mainmenuDrawn=not mainMenuDrawn
- local menuDrawn=not menuDrawn
- end
- end
- addEventHandler("onClientKey",getRootElement(),clickedF1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement