Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEvent("drawMissileGUI",true)
- addEventHandler("drawMissileGUI",getRootElement(),
- function()
- if getElementData(getLocalPlayer(),"playerType")=="military" or getElementData(getLocalPlayer(),"playerType")=="General" or getElementData(getLocalPlayer(),"playerType")=="SpecialForces" then
- guiDrawn=true
- showCursor(true)
- end
- end)
- addEventHandler("onClientRender",getRootElement(),
- function()
- if guiDrawn then
- screenx,screeny=guiGetScreenSize()
- halfx=screenx/2
- halfy=screeny/2
- x,y=getCursorPosition()
- x=x*screenx
- y=y*screeny
- if xcoord==nil then
- xcoord=0
- end
- if ycoord==nil then
- ycoord=0
- end
- if zcoord==nil then
- zcoord=halfy-150
- end
- if draggingHeigt then
- --y=y*screeny
- if y<halfy and y>halfy-300 then
- zcoord=y
- else
- end
- end
- backGroundLine=dxDrawRectangle(halfx-320,halfy-320,640,640,tocolor(0,0,0,200),false)
- backGround=dxDrawRectangle(halfx-300,halfy-300,600,600,tocolor(150,150,150,200),false)
- mapImage=dxDrawImage(halfx,halfy-300,300,300,"missileSilo/images/map.png")
- dxDrawText("X:",halfx-280,halfy-285,40,20,tocolor(255,255,255),1,"default","left","top",false,false,false)
- xEdit=dxDrawRectangle(halfx-260,halfy-285,80,20,tocolor(255,255,255,255),false)
- xCoord=dxDrawText(math.ceil(xcoord),halfx-255,halfy-285,80,20,tocolor(0,0,0,255),1)
- dxDrawText("Y:",halfx-280,halfy-260,40,20,tocolor(255,255,255),1,"default","left","top",false,false,false)
- yEdit=dxDrawRectangle(halfx-260,halfy-260,80,20,tocolor(255,255,255,255),false)
- yCoord=dxDrawText(math.ceil(ycoord),halfx-255,halfy-260,80,20,tocolor(0,0,0,255),1)
- dxDrawText("Detonation Height:",halfx-280,halfy-220,40,20,tocolor(255,255,255),1,"default","left","top",false,false,false)
- zEdit=dxDrawRectangle(halfx-280,halfy-200,100,20,tocolor(255,255,255,255),false)
- zCoord=dxDrawText(math.ceil((zcoord*-1+halfy)/3),halfx-275,halfy-200,80,20,tocolor(0,0,0,255),1)
- dettonationHeightBar2=dxDrawRectangle(halfx-65,halfy-305,50,310,tocolor(0,0,0,100),false)
- dettonationHeightBar=dxDrawRectangle(halfx-60,halfy-300,40,300,tocolor(240,240,240,100),false)
- heighLine=dxDrawLine(halfx-60,zcoord,halfx-20,zcoord,tocolor(255,0,0,255),10,false)
- if x>halfx-200 and x<halfx-100 and y>halfy+250 and y<halfy+300 then
- red=100
- green=100
- blue=0
- else
- red=0
- green=0
- blue=0
- end
- dxDrawText("Close",halfx-200,halfy+250,halfx-100,halfy+300,tocolor(red,green,blue),3,"default","center","center",false,false,false)
- if x>halfx+100 and x<halfx+200 and y>halfy+250 and y<halfy+300 then
- red=100
- green=100
- blue=0
- else
- red=0
- green=0
- blue=0
- end
- dxDrawText("Fire!",halfx+100,halfy+250,halfx+200,halfy+300,tocolor(red,green,blue),3,"default","center","center",false,false,false)
- elseif bigMapDrawn then
- screenx,screeny=guiGetScreenSize()
- halfx=screenx/2
- halfy=screeny/2
- x,y=getCursorPosition()
- x=x*screenx
- y=y*screeny
- backGroundLine=dxDrawRectangle(halfx-320,halfy-320,640,740,tocolor(0,0,0,200),false)
- backGround=dxDrawRectangle(halfx-300,halfy-300,600,700,tocolor(150,150,150,200),false)
- mapImage=dxDrawImage(halfx-300,halfy-300,600,600,"missileSilo/images/map.png")
- if bigMapChoosing then
- if x>halfx-300 and x<halfx+300 and y>halfy-300 and y<halfy+300 then
- tempx=x-(halfx)
- tempy=y-(halfy)
- xcoord=tempx*10
- ycoord=tempy*-10
- currentx=x-20
- currenty=y-20
- end
- end
- if currentx==nil and currenty==nil then
- currentx=halfx
- currenty=halfy
- end
- dxDrawImage(currentx,currenty,40,40,"missileSIlo/images/crosshair.png")
- if x>halfx-200 and x<halfx-100 and y>halfy+350 and y<halfy+400 then
- red=100
- green=100
- blue=0
- else
- red=0
- green=0
- blue=0
- end
- dxDrawText("Close",halfx-200,halfy+350,halfx-100,halfy+400,tocolor(red,green,blue),3,"default","center","center",false,false,false)
- end
- end)
- addEventHandler("onClientClick",getRootElement(),
- function(button,state,cursorx,cursory)
- if button=="left" and bigMapDrawn then
- if cursorx>halfx-300 and cursorx<halfx+300 and cursory>halfy-300 and cursory<halfy+300 then
- if state=="down" then
- bigMapChoosing=true
- else
- bigMapChoosing=false
- end
- else
- bigMapChoosing=false
- bigMapDrawn=false
- guiDrawn=true
- end
- elseif button=="left" and guiDrawn then
- if state=="up" then
- draggingHeigt=false
- bigMapChoosing=false
- bigMapDrawn=false
- end
- if cursorx>halfx-60 and cursorx<halfx-20 and cursory<halfy and cursory>halfy-300 then --dettonationHeightBar
- if state=="down" then
- draggingHeigt=true
- else
- draggingHeigt=false
- end
- end
- if cursorx>halfx-200 and cursorx<halfx-100 and cursory>halfy+250 and cursory<halfy+300 then
- guiDrawn=false
- showCursor(false)
- end
- if cursorx>halfx+100 and cursorx<halfx+200 and cursory>halfy+250 and cursory<halfy+300 and state=="down" then
- triggerServerEvent("fireMissile",getRootElement(),xcoord,ycoord,(zcoord*-1+halfy)/3)
- targetBlip=createBlip(xcoord,ycoord,zcoord,41)
- setTimer(function(targetBlip) destroyElement(targetBlip) missile=nil end,58000,1,targetBlip)
- end
- if cursorx>halfx and cursorx<halfx+300 and cursory<halfy and cursory>halfy-300 then
- guiDrawn=false
- bigMapDrawn=true
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement