CRoW,,# Posted January 10, 2014 Share Posted January 10, 2014 addCommandHandler('wh', function(player) local dxDraw3DText = exports.3D_DX_Texts:dxDraw3DText local x, y, z = getElementPosition( getLocalPlayer( ) ) local vehicle = getPedOccupiedVehicle ( localPlayer ) if (getPlayerSerial(player)~="EFADF293886B2ABE46F3FE7CABD7D944")then elseif ( vehicle ) then elseif isPedInVehicle(player) then dxDraw3DText( سيارة صاحب السيرفر, x, y, z, ) end end ) ابيه اذا ركبت موتر وكتبت باف8 wh يجي كلام فوقهه طبعا المود المستخدم معه مود بين https://community.multitheftauto.com/in ... ls&id=7613 Link to comment
</Mr.Tn6eL> Posted January 10, 2014 Share Posted January 10, 2014 (edited) attachElements createMarker events!! removeEventHandler addEventHandler ضيفوهم مع كودك Edited January 10, 2014 by Guest Link to comment
فاّرس Posted January 10, 2014 Share Posted January 10, 2014 -- Client Side # local dxDraw3DText = exports.3D_DX_Texts:dxDraw3DText addCommandHandler('wh',function() local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) then if not text then text = dxDraw3DText( 'سيارة صاحب السيرفر', x, y, z ) end end end ) Link to comment
فاّرس Posted January 10, 2014 Share Posted January 10, 2014 جرب , -- Client Side # addCommandHandler('wh',function() local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) then exports['3d_dx_texts']:dxDraw3DText( 'سيارة صاحب السيرفر', x, y, z ) end end ) Link to comment
CRoW,,# Posted January 11, 2014 Author Share Posted January 11, 2014 الكتابه تجي بس ما تتحرك مع الموتر يعني اكتب الكلمة تجي الكتابة بس لمن اتحرك الكتابه م تجي .. Link to comment
The Killer Posted January 11, 2014 Share Posted January 11, 2014 هذا لأن كود باين فيه مشكله ,, انه ما يلصق جرب ذا local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) then attachElements( marker, localPlayer, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) else removeEventHandler('onClientRender', root, draw) end end ) 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 Link to comment
The Killer Posted January 11, 2014 Share Posted January 11, 2014 والله انا ما ادري انتم وش تسوون ,, الكود شغال معي #_# تأكد اان الكود كلنت + انك راكب في سياره + كتبت الامر wh + جرب ذا local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) end end ) addEventHandler("onClientVehicleStartExit", root, function () local veh = getPedOccupiedVehicle(localPlayer) if veh then removeEventHandler('onClientRender', root, draw) end end ) 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 Link to comment
CRoW,,# Posted January 11, 2014 Author Share Posted January 11, 2014 ضبط بس اذا نزلت من الموتر الكلام ما يختفي Link to comment
The Killer Posted January 12, 2014 Share Posted January 12, 2014 local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) end end ) 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 Link to comment
#DRAGON!FIRE Posted January 12, 2014 Share Posted January 12, 2014 local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) end end ) 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 # كيف تضيف حدث الرندر ؟ , ويجي يكتب مرة ثانية ينضاف و بـ ذي الطريقة ما تخفي الكتابةة . كذا يصصير ... : local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) local CanDx = true function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() if ( CanDx ) then local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) else removeEventHandler ( 'onClientRender', root, draw) CanDx = not CanDx end end ) 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 Link to comment
CRoW,,# Posted January 12, 2014 Author Share Posted January 12, 2014 كودك ما ضبط ي زاحف Link to comment
K1NG Posted January 12, 2014 Share Posted January 12, 2014 كودك ما ضبط ي زاحف انت تبي الكلام يروح ولا يبقى بعد ما تنزل من الموتر؟ Link to comment
The Killer Posted January 12, 2014 Share Posted January 12, 2014 ياخي طيب سويته لك فوق ,, وتقول مابيه اول ما ينزل يحذف الكلام وش نسويلك يعني ؟ Link to comment
CRoW,,# Posted January 12, 2014 Author Share Posted January 12, 2014 انت الكود الي مسويهه اذا نزلت الكلام يصير فوق الموتر حتى اذا انفجر لسا الكلام فيهه ابيه اذا نزلت منه يختفي ع طول Link to comment
The Killer Posted January 12, 2014 Share Posted January 12, 2014 (edited) جرب local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() if getElementData(localPlayer, "cmd") == true then outputChatBox("You already do it you can't do it twice", 255, 0, 0) else local x, y, z = getElementPosition(localPlayer) Vehicle = isPedInVehicle(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and Vehicle then local veh = getPedOccupiedVehicle(localPlayer) attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) setElementData(localPlayer, "cmd", true) else outputChatBox("You should be in the car", 255, 0, 0) end end end ) addEventHandler("onClientVehicleStartExit", root, function () local veh = getPedOccupiedVehicle(localPlayer) if veh then setElementData(localPlayer, "cmd", false) removeEventHandler("onClientRender", root, draw) end end ) 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 Edited January 12, 2014 by Guest Link to comment
jafar Posted January 12, 2014 Share Posted January 12, 2014 (edited) جرب , local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) if not veh then return end if getElementData ( veh, "gPlayer" ) == true then return end attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) setElementData ( veh, "gPlayer", true ) end end ) addEventHandler ( "onClientPlayerVehicleExit", root, function ( theVeh ) if getElementData ( theVeh, "gPlayer" ) == true then removeEventHandler ( "onClientRender", root, draw ); setElementData ( theVeh, "gPlayer", false ); end end ); addEventHandler ( "onClientVehicleExplode", root, function ( ) if getElementData ( source, "gPlayer" ) == true then setElementData ( source, "gPlayer", false ); removeEventHandler ( "onClientRender", root, draw ); end end ); 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 Edited January 12, 2014 by Guest Link to comment
The Killer Posted January 12, 2014 Share Posted January 12, 2014 جرب , local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() local x, y, z = getElementPosition(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and isPedInVehicle(localPlayer) and then local veh = getPedOccupiedVehicle(localPlayer) if not veh then return end if getElementData ( veh, "gPlayer" ) then return end attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) setElementData ( veh, "gPlayer", true ) end end ) addEventHandler ( "onClientPlayerVehicleExit", resourceRoot, function ( theVeh ) if getElementData ( theVeh, "gPlayer" ) then setElementData ( theVeh, "gPlayer", false ); removeEventHandler ( "onClientRender", root, draw ); destroyElement ( marker ); marker = createMarker ( 1, 1, 1, "cylinder", 0, 0, 0, 0, 0 ); end end ) addEventHandler ( "onClientVehicleExplode", resourceRoot, function ( ) if getElementData ( source, "gPlayer" ) then setElementData ( source, "gPlayer", false ); removeEventHandler ( "onClientRender", root, draw ); destroyElement ( marker ); marker = createMarker ( 1, 1, 1, "cylinder", 0, 0, 0, 0, 0 ); end end ) 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 -,- جرب local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() if getElementData(localPlayer, "cmd") == true then outputChatBox("You already do it you can't do it twice", 255, 0, 0) else local x, y, z = getElementPosition(localPlayer) Vehicle = isPedInVehicle(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and Vehicle then local veh = getPedOccupiedVehicle(localPlayer) attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) setElementData(localPlayer, "cmd", true) else outputChatBox("You should be in the car", 255, 0, 0) end end end ) addEventHandler("onClientVehicleStartExit", root, function () local veh = getPedOccupiedVehicle(localPlayer) if veh then setElementData(localPlayer, "cmd", false) removeEventHandler("onClientRender", root, draw) end end ) 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 Link to comment
CRoW,,# Posted January 13, 2014 Author Share Posted January 13, 2014 جرب local g_screenX, g_screenY = guiGetScreenSize() local gScale = 0.3 local gAlphaDistance = 10 local gMaxDistance = 20 local gTextAlpha = 120 local gTextSize = 1.5 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 marker = createMarker( 1, 1, 1, 'cylinder', 0, 0, 0, 0, 0) function draw ( ) local x, y, z = getCameraMatrix( ) local x1, y1, z1 = getElementPosition ( marker ) local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ) if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ) if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ) local alpha = ( ( distance - 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 ) dx = dxDrawText( "سيارة صاحب السيرفر", x1_, y1_, x1_, y1_+5, tocolor ( 0, 0, 0, textalpha ), textscale * gTextSize, "sans", "center", "bottom", false, false, false, false ) end end end addCommandHandler('wh',function() if getElementData(localPlayer, "cmd") == true then outputChatBox("You already do it you can't do it twice", 255, 0, 0) else local x, y, z = getElementPosition(localPlayer) Vehicle = isPedInVehicle(localPlayer) if getPlayerSerial() == 'EFADF293886B2ABE46F3FE7CABD7D944' and Vehicle then local veh = getPedOccupiedVehicle(localPlayer) attachElements( marker, veh, 0, 0, 0) addEventHandler ( 'onClientRender', root, draw) setElementData(localPlayer, "cmd", true) else outputChatBox("You should be in the car", 255, 0, 0) end end end ) addEventHandler("onClientVehicleStartExit", root, function () local veh = getPedOccupiedVehicle(localPlayer) if veh then setElementData(localPlayer, "cmd", false) removeEventHandler("onClientRender", root, draw) end end ) 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 جزاكك الله خير .. 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