[UCG]Mike Posted August 21, 2014 Share Posted August 21, 2014 Hey guys idk where is the problem plz fix --\\\\\\\\\\\\\\\\\\\\\\\\\\ --// 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 } }; local markerp = createMarker ( 125.67847442627, 1931.6518554688, 18.23836517334, "cylinder", 2, 41, 175, 5 ); local marker1p = createMarker ( 1550.4619140625, -1634.8922119141, 12.555536270142, "cylinder", 2, 41, 175, 5 ); addEventHandler ( 'onClientRender', root, function ( ) -- local x, y, z = getCameraMatrix(); local x1, y1, z1 = getElementPosition ( markerp ); local x2, y2, z2 = getElementPosition ( marker1p ); local distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); local distance_2 = getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ); -- -- 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 ); -- dxDrawText( "Military Forces", x1_, y1_, x1_, y1_, tocolor ( 17, 73, 0, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); 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 ); -- dxDrawText( "Military Forces", x2_, y2_, x2_, y2_, tocolor ( 17, 73, 0, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end end ); -- ////////////////////////////////// -- // MATH FUNCTIONS // -- ////////////////////////////////// function math.evalCurve( curve, input ) if input < curve[ 1 ][ 1 ] then return curve[ 1 ][ 2 ]; end for idx = 2, #curve do if input < curve[ idx ][ 1 ] then local x1 = curve[ idx - 1 ][ 1 ]; local y1 = curve[ idx - 1 ][ 2 ]; local x2 = curve[ idx ][ 1 ]; local y2 = curve[ idx ][ 2 ]; local alpha = ( input - x1 ) / ( x2 - x1 ); return math.lerp( y1, y2, alpha ); end end return curve[ #curve ][ 2 ]; end function math.lerp( from, to, alpha ) return from + ( to-from ) * alpha; end Wnd = guiCreateWindow(544,193,321,470,"CNG ~ Job",false) guiWindowSetSizable( Wnd, false ) button = guiCreateButton(163,426,149,35,"No thanks!",false,Wnd) button2 = guiCreateButton(11,426,149,35,"Take job!",false,Wnd) label = guiCreateLabel(14,22,257,17,"Information about this job:",false,Wnd) memo = guiCreateMemo(9,44,322,217,"",false,Wnd) guiSetFont(label,"default-bold-small") showCursor(false) guiSetVisible( Wnd, false ) guiWindowSetSizable( Wnd, false ) guiWindowSetMovable( Wnd, true ) skins = { {"Army", 287}, } skinG = guiCreateGridList(9,288,322,133,false,Wnd) guiGridListAddColumn(skinG, "Skins", 0.85) for i,skins in ipairs(skins) do row = guiGridListAddRow(skinG) -- guiGridListSetItemText(skinG, row, 1, tostring(skins[1]), false, false) guiGridListSetItemData(skinG, row, 1, tostring(skins[2])) end function Pilotjob(hitElement) if getElementData (source, "Group") == "Military Forces" then if getElementType(hitElement) == "player" and (hitElement == localPlayer) then if not guiGetVisible(Wnd) then guiSetVisible(Wnd, true) showCursor(true) end end end end addEventHandler("onClientMarkerHit", markerp, Pilotjob) addEventHandler("onClientMarkerHit", marker1p, Pilotjob) function takeJob() local row, col = guiGridListGetSelectedItem(skinG) if (row and col and row ~= -1 and col ~= -1) then local models = tonumber(guiGridListGetItemData(skinG, row, 1)) if model ~= "" then triggerServerEvent("Be MF", localPlayer, models) guiSetVisible(Wnd,false) showCursor(false) end end end addEventHandler("onClientGUIClick", button2, takeJob, false) function close() if (source == button) then guiSetVisible(Wnd,false) showCursor(false) end end addEventHandler("onClientGUIClick", button, close) afText = {} myTextItem = {} function warnText ( aWText, player ) if ( myTextItem[player] ) then textDestroyTextItem ( myTextItem[player]) end afText[player] = textCreateDisplay () textDisplayAddObserver( afText[player], player ) myTextItem[player] = textCreateTextItem ( aWText, 0.22, 0.8,0.5 , 255, 0, 0, 255, 3 ) textDisplayAddText ( afText[player], myTextItem[player] ) -- outputChatBox ( textA, player ) setTimer ( textDestroyTextItem, 5000, 1, myTextItem[player], player ) end function createPilotTeam () Pilotteam = createTeam ("Military Forces", 17, 73, 0 ) end addEventHandler ("onResourceStart", resourceRoot, createPilotTeam) function joinPilot(id) setPlayerTeam(source,Pilotteam) setPlayerNametagColor ( source, 17, 73, 0 ) setElementModel(source, id) setElementData(source, "Occupation","Military Forces", true) giveWeapon(source, 3, 1) playeraccount = getPlayerAccount( source ) setAccountData( playeraccount, "team", "Military Forces", true ) end addEvent("Be MF", true) addEventHandler("Be MF",root,joinPilot) function removePilot() setPlayerTeam(source, 0) playeraccount = getPlayerAccount(source) if not getAccountData(playeraccount, "standardskin") then setElementModel(source, 0) else setElementModel(source,getAccountData(playeraccount,"standardskin")) end end addEvent("removePilot", true) addEventHandler("removePilot",root,removePilot) markers = { } blips = { } peds = { } mposi = { } mposii = {} function startJob ( thePlayer ) local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 5.0, 255, 0, 0, 0 ) mposi = { getElementPosition( markers [ thePlayer ] ) } local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) peds [ thePlayer ] = createPed( skins, x, y, z ) blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 62 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) end function inVEH ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then if ( getElementModel ( source ) == 511 ) then startJob ( thePlayer ) end end end addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) function warpit ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local vehiclee = getPedOccupiedVehicle ( thePlayer ) if ( getElementModel ( vehiclee ) == 511 ) then local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 5.0, 255, 0, 0, 50 ) mposii = { getElementPosition( markers [ thePlayer ] ) } blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) addEventHandler ( "onMarkerHit", markers [ thePlayer ], pickmeup ) end end end function pickmeup ( thePlayer ) if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then local mx, my, mz = unpack ( mposi ) local mmx, mmy, mmz = unpack ( mposii ) local money = getDistanceBetweenPoints2D ( mx, my, mmx, mmy ) finalmoney = math.floor ( money ) if finalmoney then setTimer( givePlayerMoney, 3000, 1, thePlayer, finalmoney ) setTimer( outputChatBox, 3000, 1, thePlayer, "You have earned ".. money .."!", 0, 144, 0) setTimer ( function ( ) if ( isElement ( peds [ thePlayer ] ) ) then destroyElement ( peds [ thePlayer ] ) end startJob ( thePlayer ) end ,3000, 1 ) end end end Link to comment
Bonsai Posted August 21, 2014 Share Posted August 21, 2014 Maybe some more information, debug log etc.? You can't just throw your stuff at us and wait until someone fixes it. Link to comment
Et-win Posted August 21, 2014 Share Posted August 21, 2014 You can't just throw your stuff at us and wait until someone fixes it. And scripts which aren't his. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now