Jump to content

Help me please: (


Estevam2d

Recommended Posts

How do I get the window does not open when a vehicle over to the cylinder ?

  
GUIEditor = { 
    window = {}, 
    staticimage = {}, 
    label = {}, 
    button = {}, 
    progressbar = {} 
} 
        ar = guiCreateWindow(290, 135, 446, 140, "Area de mineiraçao", false) 
        guiSetAlpha(ar, 500.0) 
        guiWindowSetSizable(ar, false) 
        guiSetVisible(ar, false) 
        GUIEditor.staticimage[1] = guiCreateStaticImage(17, 47, 64, 64, "images/Argila.png", false, ar) 
        GUIEditor.label[1] = guiCreateLabel(123, 65, 313, 32, "<---= Clique na imagem ao lado para mineirar.", false, ar) 
        GUIEditor.label[4] = guiCreateLabel(213, 113, 253, 32, "Minerio de Argila +$2x100", false, ar) 
        GUIEditor.label[7] = guiCreateLabel(59, 378, 383, 36, "ATENÇÃO: Evento de mineiraçao X2 Valido até dia 05/01/2014 !", false, ar)     
        GUIEditor.progressbar = guiCreateProgressBar(319, 285, 410, 59, false)     
        GUIEditor.button[1] = guiCreateButton(404, 27, 22, 20, "Sair", true, ar) 
        guiSetVisible(GUIEditor.progressbar, false) 
        wepMarker1 = createMarker(460.407, 889.158, -28.695, "cylinder", 1.9, 251, 230, 0,100) 
        function Towjob(hitElement) 
if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
                  if not guiGetVisible(ar) then 
local team = getPlayerTeam(hitElement) 
    local theTeamName = getTeamName(team) 
    if ( theTeamName == "Mineiro" )then      
guiSetVisible(ar, true) 
                       showCursor(true) 
           else 
triggerServerEvent("Box11", hitElement) 
guiSetVisible(ar, false) 
                       showCursor(false) 
end        
end 
             end 
        end 
       addEventHandler("onClientMarkerHit", wepMarker1, Towjob)      
   function Towjobleave(leaveElement) 
             if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
             if guiGetVisible(ar) then 
             guiSetVisible(ar, false) 
                       showCursor(false) 
                  end 
             end 
        end 
           addEventHandler("onClientMarkerLeave", wepMarker1, Towjobleave) 
addEventHandler("onClientGUIClick", GUIEditor.staticimage[1], 
function () 
             progress = guiProgressBarGetProgress() 
guiSetVisible(ar, 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("Argila", localPlayer) 
              guiSetVisible(GUIEditor.progressbar, false) 
              showCursor(false)  
              guiProgressBarSetProgress(GUIEditor.progressbar, 0) 
end, 
50000,1)     
end) 
  
addEventHandler("onClientGUIClick", GUIEditor.button[1], 
function () 
getPropagated(ar, true) 
guiSetVisible(ar, false) 
showCursor(false) 
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 distance_1 = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); 
             
            -- 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( "Mineirar Argila", x1_, y1_, x1_, y1_, tocolor ( 255, 0, 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 

Link to comment
  • Moderators
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 ) 

How many timers are you going to set?

Jesus! You have no idea how many lagg that will cause, when you write every script like that. Or do you ?

  
setTimer(function() 
lol = lol+10 
guiProgressBarSetProgress(GUIEditor.progressbar,lol) 
end,5000, 10) 
  

Link to comment

Here, i think this is what you want, to have it so player must be out of the vehicle inorder to trigger whatever the marker does.

  
        function Towjob(hitElement) 
if getElementType(hitElement) == "player" and hitElement == localPlayer and not isPedInVehicle(hitElement) then 
                  if not guiGetVisible(ar) then 
local team = getPlayerTeam(hitElement) 
    local theTeamName = getTeamName(team) 
    if ( theTeamName == "Mineiro" )then     
guiSetVisible(ar, true) 
                       showCursor(true) 
           else 
triggerServerEvent("Box11", hitElement) 
guiSetVisible(ar, false) 
                       showCursor(false) 
end       
end 
             end 
        end 
       addEventHandler("onClientMarkerHit", wepMarker1, Towjob)     
  

I havent tested but should be somewhere along those lines, if doesnt work add a if statement after first one to see if the player is in a vehicle and if he is then dont do anything.

https://wiki.multitheftauto.com/wiki/IsPedInVehicle

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...