GUIEditor = { window = {}, staticimage = {}, label = {}, button = {}, progressbar = {} } wepgui = guiCreateWindow(290, 135, 446, 417, "Illegal Weapon Factory", false) guiWindowSetSizable(wepgui, false) guiSetVisible(wepgui, false) GUIEditor.staticimage[1] = guiCreateStaticImage(17, 47, 79, 71, ":[Lock]WeaponFactory/images/GRENADE.png", false, wepgui) GUIEditor.staticimage[2] = guiCreateStaticImage(17, 162, 79, 70, ":[Lock]WeaponFactory/images/TEC9.png", false, wepgui) GUIEditor.staticimage[3] = guiCreateStaticImage(17, 284, 79, 71, ":[Lock]WeaponFactory/images/SNIPER.png", false, wepgui) GUIEditor.label[1] = guiCreateLabel(123, 65, 313, 32, "Drag and click on the weapon that you want to create.", false, wepgui) GUIEditor.label[2] = guiCreateLabel(123, 172, 313, 32, "Drag and click on the weapon that you want to create.", false, wepgui) GUIEditor.label[3] = guiCreateLabel(123, 294, 313, 32, "Drag and click on the weapon that you want to create.", false, wepgui) GUIEditor.label[4] = guiCreateLabel(213, 113, 253, 32, "700$", false, wepgui) GUIEditor.label[5] = guiCreateLabel(213, 214, 253, 32, "200$", false, wepgui) GUIEditor.label[6] = guiCreateLabel(217, 336, 253, 32, "400$", false, wepgui) GUIEditor.label[7] = guiCreateLabel(59, 378, 383, 36, "NOTICE: TEC-9:100 Bullets/Grenade:8 Grenades/Sniper: 50 Bullets.", false, wepgui) GUIEditor.progressbar = guiCreateProgressBar(319, 285, 410, 59, false) GUIEditor.button[1] = guiCreateButton(404, 27, 22, 20, "X", false, wepgui) guiSetVisible(GUIEditor.progressbar, false) wepMarker1 = createMarker(2551.08, -1283.81, 1043, "cylinder", 2, 200, 0, 0, 50) wepMarker2 = createMarker(2543.13, -1283.69, 1043, "cylinder", 2, 200, 0, 0, 50) wepMarker3 = createMarker(2559.19, -1283.83, 1043, "cylinder", 2, 200, 0, 0, 50) setElementDimension(wepMarker1, 1) setElementInterior(wepMarker1, 2) setElementDimension(wepMarker2, 1) setElementInterior(wepMarker2, 2) setElementDimension(wepMarker3, 1) setElementInterior(wepMarker3, 2) function Towjob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) and isPedOnGround(hitElement) then if not guiGetVisible(wepgui) then local team = getPlayerTeam(hitElement) local theTeamName = getTeamName(team) if ( theTeamName == "Criminal" )then guiSetVisible(wepgui, true) showCursor(true) else triggerServerEvent("Box11", hitElement) guiSetVisible(wepgui, false) showCursor(false) end end end end addEventHandler("onClientMarkerHit", wepMarker1, Towjob) addEventHandler("onClientMarkerHit", wepMarker2, Towjob) addEventHandler("onClientMarkerHit", wepMarker3, Towjob) function Towjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) and isPedOnGround(hitElement) then if guiGetVisible(wepgui) then guiSetVisible(wepgui, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", wepMarker1, Towjobleave) addEventHandler("onClientMarkerLeave", wepMarker2, Towjobleave) addEventHandler("onClientMarkerLeave", wepMarker3, Towjobleave) addEventHandler("onClientGUIClick", GUIEditor.staticimage[1], function () progress = guiProgressBarGetProgress() guiSetVisible(wepgui, false) guiSetVisible(GUIEditor.progressbar, true) local lol = guiProgressBarGetProgress(GUIEditor.progressbar) setTimer( guiProgressBarSetProgress, 5000, 1,GUIEditor.progressbar,lol+10 ) setTimer( guiProgressBarSetProgress, 10000, 1,GUIEditor.progressbar,lol+20 ) setTimer( guiProgressBarSetProgress, 15000, 1,GUIEditor.progressbar,lol+30 ) setTimer( guiProgressBarSetProgress, 20000, 1,GUIEditor.progressbar,lol+40 ) setTimer( guiProgressBarSetProgress, 25000, 1,GUIEditor.progressbar,lol+50 ) setTimer( guiProgressBarSetProgress, 30000, 1,GUIEditor.progressbar,lol+60 ) setTimer( guiProgressBarSetProgress, 35000, 1,GUIEditor.progressbar,lol+70 ) setTimer( guiProgressBarSetProgress, 40000, 1,GUIEditor.progressbar,lol+80 ) setTimer( guiProgressBarSetProgress, 45000, 1,GUIEditor.progressbar,lol+90 ) setTimer( guiProgressBarSetProgress, 50000, 1,GUIEditor.progressbar,lol+100 ) triggerServerEvent("Box", localPlayer) timer = setTimer( function () triggerServerEvent("AK47", localPlayer) guiSetVisible(GUIEditor.progressbar, false) showCursor(false) guiProgressBarSetProgress(GUIEditor.progressbar, 0) end, 50000,1) end) addEventHandler("onClientGUIClick", GUIEditor.button[1], function () guiSetVisible(wepgui, false) showCursor(false) end) addEventHandler("onClientGUIClick", GUIEditor.staticimage[2], function () progress = guiProgressBarGetProgress() guiSetVisible(wepgui, false) guiSetVisible(GUIEditor.progressbar, true) local lol = guiProgressBarGetProgress(GUIEditor.progressbar) setTimer( guiProgressBarSetProgress, 5000, 1,GUIEditor.progressbar,lol+10 ) setTimer( guiProgressBarSetProgress, 10000, 1,GUIEditor.progressbar,lol+20 ) setTimer( guiProgressBarSetProgress, 15000, 1,GUIEditor.progressbar,lol+30 ) setTimer( guiProgressBarSetProgress, 20000, 1,GUIEditor.progressbar,lol+40 ) setTimer( guiProgressBarSetProgress, 25000, 1,GUIEditor.progressbar,lol+50 ) setTimer( guiProgressBarSetProgress, 30000, 1,GUIEditor.progressbar,lol+60 ) setTimer( guiProgressBarSetProgress, 35000, 1,GUIEditor.progressbar,lol+70 ) setTimer( guiProgressBarSetProgress, 40000, 1,GUIEditor.progressbar,lol+80 ) setTimer( guiProgressBarSetProgress, 45000, 1,GUIEditor.progressbar,lol+90 ) setTimer( guiProgressBarSetProgress, 50000, 1,GUIEditor.progressbar,lol+100 ) triggerServerEvent("Box10", localPlayer) timer = setTimer( function () triggerServerEvent("TEC9", localPlayer) guiSetVisible(GUIEditor.progressbar, false) showCursor(false) guiProgressBarSetProgress(GUIEditor.progressbar, 0) end, 50000,1) end) addEventHandler("onClientGUIClick", GUIEditor.staticimage[3], function () progress = guiProgressBarGetProgress() guiSetVisible(wepgui, false) guiSetVisible(GUIEditor.progressbar, true) local lol = guiProgressBarGetProgress(GUIEditor.progressbar) setTimer( guiProgressBarSetProgress, 5000, 1,GUIEditor.progressbar,lol+10 ) setTimer( guiProgressBarSetProgress, 10000, 1,GUIEditor.progressbar,lol+20 ) setTimer( guiProgressBarSetProgress, 15000, 1,GUIEditor.progressbar,lol+30 ) setTimer( guiProgressBarSetProgress, 20000, 1,GUIEditor.progressbar,lol+40 ) setTimer( guiProgressBarSetProgress, 25000, 1,GUIEditor.progressbar,lol+50 ) setTimer( guiProgressBarSetProgress, 30000, 1,GUIEditor.progressbar,lol+60 ) setTimer( guiProgressBarSetProgress, 35000, 1,GUIEditor.progressbar,lol+70 ) setTimer( guiProgressBarSetProgress, 40000, 1,GUIEditor.progressbar,lol+80 ) setTimer( guiProgressBarSetProgress, 45000, 1,GUIEditor.progressbar,lol+90 ) setTimer( guiProgressBarSetProgress, 50000, 1,GUIEditor.progressbar,lol+100 ) triggerServerEvent("Box9", localPlayer) timer = setTimer( function () triggerServerEvent("Sniper", localPlayer) guiSetVisible(GUIEditor.progressbar, false) showCursor(false) guiProgressBarSetProgress(GUIEditor.progressbar, 0) end, 50000,1) end) --// Setting local g_screenX, g_screenY = guiGetScreenSize(); local gScale = 0.3; local gAlphaDistance = 25; local gMaxDistance = 50; -- Max Distance local gTextAlpha = 120; local gTextSize = 1; local gAlphaDiff = gMaxDistance - gAlphaDistance; gScale = 1 / gScale * 800 / g_screenY; local gMaxScaleCurve = { { 0, 0 }, { 3, 3 }, { 13, 5 } }; local gTextScaleCurve = { { 0, 0.8 }, { 0.8, 1.2 }, { 99, 99 } }; local gTextAlphaCurve = { { 0, 0 }, { 25, 100 }, { 120, 190 }, { 255, 190 } }; addEventHandler ( 'onClientRender', root, function ( ) -- local x, y, z = getCameraMatrix(); local x1, y1, z1 = getElementPosition ( wepMarker1 ); local x2, y2, z2 = getElementPosition ( wepMarker2 ); local x3, y3, z3 = getElementPosition ( wepMarker3 ); local distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); local distance_2 = getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ); local distance_3 = getDistanceBetweenPoints3D( x, y, z, x3, y3, z3 ); -- Marker #1 if distance_1 <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ); if x1_ and y1_ then -- local scale = 1 / ( gScale * ( distance_1 / gMaxDistance ) ); local alpha = ( ( distance_1 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); -- end -- Marker #2 elseif distance_2 <= gMaxDistance then local x2_, y2_ = getScreenFromWorldPosition( x2, y2, z2 + 0.95, 0.06 ); if x2_ and y2_ then -- local scale = 1 / ( gScale * ( distance_2 / gMaxDistance ) ); local alpha = ( ( distance_2 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); -- end -- Marker #3 elseif distance_3 <= gMaxDistance then local x3_, y3_ = getScreenFromWorldPosition( x3, y3, z3 + 0.95, 0.06 ); if x3_ and y3_ then -- local scale = 1 / ( gScale * ( distance_3 / gMaxDistance ) ); local alpha = ( ( distance_3 - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); -- end end end ); -- //////////////////////////////////