Jump to content

Sasu

MTA Contributors
  • Posts

    1,056
  • Joined

  • Last visited

Posts posted by Sasu

  1. A lo mejor sea porque las variables w5 y w6 cambian al utilizar el comando /deathcar, y por lo tanto el setWeaponState se ejecutan en las ultimas armas que han sido creadas. Lo que puedes hacer es utilizar una tabla y emplear el jugador o el vehiculo como indice, algo asi como weapon[element][1] = createWeapon(...)

  2. function joinQuit() 
        for _, v in ipairs( textos ) do 
            local i = v[1] 
            local texto = v[2] 
            local ancho = dxGetTextWidth(  texto,  0.60, font2, true ) 
            --outputDebugString( ancho ) 
            local cuenta = ( getTickCount(  ) - textos["tick2_"..tostring(i)] ) 
            local endTime = textos["tick_"..tostring(i)] + 1000 
            local elapsedTime = getTickCount() - textos["tick_"..tostring(i)] 
            local duration = endTime - textos["tick_"..tostring(i)] 
            local progress = elapsedTime / duration 
            local xe, x2, ae = interpolateBetween ( 0, 0, 0, ancho+2, ancho+1, 255, progress, "OutQuad") 
            --outputDebugString( xe ) 
            local alp = 0 
            textos["rectangle_"..tostring(i)], textos["text_"..tostring(i)], alp =  xe , x2 , ae 
      
            if cuenta >= 2500 then 
                alp = 0 
                local newcount = math.floor( ( cuenta / 10  ) - 250 ) 
                if newcount <= 100 then 
                    textos["texty_"..tostring(i)] = newcount 
                end 
                if newcount <= 100 then 
                    textos["rectangley_"..tostring(i)] = newcount 
                end 
                local newcounts = math.floor( ( ( cuenta / 10 ) - 250 ) * 2.5 ) 
                if newcounts <= 250 then 
                    textos["alpha_"..tostring(i)]  = newcounts 
                end 
                if newcounts >= 240 then 
                    textos["alpha_"..tostring(i)] = 250 
                    table.remove( textos, 1 ) 
                end     
            end 
              if 200 - textos["alpha_"..tostring(i)]  - 175 > 0 then 
                   dxDrawRectangle(  x - textos["rectangle_"..tostring(i)], ( ( 290 -textos["rectangley_"..tostring(i)]) / sy ) * y , ( 165+ancho / sx ) * x, ( 15 / sy ) * y, tocolor(0, 0, 0, 200 -( textos["alpha_"..tostring(i)]  - 175 ) ), false) 
              end 
              if 200 -textos["alpha_"..tostring(i)] > 0 then 
                   dxDrawText(texto, x - textos["text_"..tostring(i)]  , ( ( 290-textos["texty_"..tostring(i)] ) / sy ) * y , ( 500 / sx ) * x, ( 315 / sy ) * y, tocolor(255, 255, 255, 200 -textos["alpha_"..tostring(i)] ), 0.60, font2, "left", "top", false, false, false, true, false) 
              end 
         end 
    end 
    addEventHandler("onClientRender", root, joinQuit ) 
      
    function outputBarMessage( msj ) 
        if not textos then 
            textos = {} 
        end 
        if not id then 
            id = {} 
        end 
        textos["tick2_"..tostring(#id+1)] = getTickCount(  ) 
        textos["tick_"..tostring(#id+1)] = getTickCount(  ) 
        textos["rectangle_"..tostring(#id+1)] = 0 
        textos["text_"..tostring(#id+1)] = 0 
        textos["rectangley_"..tostring(#id+1)] = 0 
        textos["texty_"..tostring(#id+1)] = 0 
        textos["alpha_"..tostring(#id+1)] = 0 
        table.insert( textos, { #id+1, tostring( msj ) }) 
        table.insert( id, { #id+1 }) 
    end 
    

  3. local x,y,z = getElementPosition(getLocalPlayer()) 
            for i,veh in ipairs(getElementsByType("vehicle")) do 
                local px,py,pz = getElementPosition (veh) 
                local vehID = getElementModel(veh) 
                local vehicle = getPedOccupiedVehicle(getLocalPlayer()) 
                if veh ~= vehicle then 
                    if vehID ~= 548 then 
                        local pdistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) 
                        if pdistance <= 6 then 
                            --Get screenposition 
                            local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) 
                            if sx and sy then 
                                --Draw Vehicle 
                                vNames = { 
                                ["Sabre"] = "Cajaconruedas" 
                                } 
                                local vName  = getVehicleName(veh) 
                                vName = vNames[vName] or vName 
                                local w = dxGetTextWidth(vName,1.02,"default-bold") 
                                dxDrawText ( vName, sx-(w/2), sy, sx-(w/2), sy, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" )   <---- 1322  
                            end 
                        end 
                    end 
                end 
            end 
    

    Te recomiendo poner la tabla afuera de la funcion.

  4. signos = {"$", "%", "!", "#"} 
      
    function register() 
      ------- 
      ------- 
      ------- 
        for _, text in ipairs(signos) do 
             if string.find(username, text) then 
                 outputChatBox("No esta permitido este signo ( " ..text.." )" ) 
                 return 
             end 
        end 
    end 
    

  5. addEventHandler ( "onVehicleExplode", root, 
        function (  ) 
            if ( vehicle [ source ] ) then 
                setTimer ( 
                    function ( source ) 
                        destroyElement ( source ) 
                        vehicle [ source ] = nil 
                    end, 5000, 1, source 
                ) 
            end 
        end 
    ) 
    

    Also, your table is 'vehicles' and not 'vehicle', isn't it?

×
×
  • Create New...