Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2016-12-18, 20:00


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

chce aby podmieniane tekstury na moim serwerze byly takie jakie sa bo jak wlacze ten snieg to jakby wylaczal sie ten skrypt i zostaja stare tekstury danego obiektu z gta sa

wynagradzam piwem i respektem

local helpMessage ""
local helpMessageTime 4000
local helpMessageY 0.2

local bEffectEnabled
local noiseTexture
local snowShader
local treeShader
local naughtyTreeShader
addEventHandler"onClientResourceStart"resourceRoot,
    function()
        triggerEvent"switchGoundSnow"resourceRoottrue )
    end
)

function toggleGoundSnow()
    triggerEvent"switchGoundSnow"resourceRootnot bEffectEnabled )
end
addCommandHandler('snieg',toggleGoundSnow)
--addCommandHandler('Toggle ground snow',toggleGoundSnow)
--bindKey("F7","down","Toggle ground snow")


--------------------------------
-- Switch effect on or off
--------------------------------
function switchGoundSnowbOn )
    if bOn then
        enableGoundSnow()
    else
        disableGoundSnow()
    end
end
addEvent"switchGoundSnow"true )
addEventHandler"switchGoundSnow"resourceRootswitchGoundSnow )


----------------------------------------------------------------
----------------------------------------------------------------
-- Effect clever stuff
----------------------------------------------------------------
----------------------------------------------------------------
local maxEffectDistance 100       -- To speed up the shaderdon't use it for objects further away than this

-- List of world texture name matches
-- (The ones later in the list will take priority) 
local snowApplyList = {
                        "*",                -- Everything!
                }

-- List of world textures to exclude from this effect
local snowRemoveList = {
                        "",                                             -- unnamed

                        "*water*", "sw_sand", "coral",                  -- sea
                    }

local treeApplyList = {
                        "sm_des_bush*", "*tree*", "*ivy*", "*pine*",    -- trees and shrubs
                        "veg_*", "*largefur*", "hazelbr*", "weeelm",
                        "*branch*", "cypress*",
                        "*bark*", "gen_log", "trunk5",
                        "bchamae", "vegaspalm01_128",

    }

local naughtyTreeApplyList = {
                        "planta256", "sm_josh_leaf", "kbtree4_test", "trunk3",                  -- naughty trees and shrubs
                        "newtreeleaves128", "ashbrnch", "pinelo128", "tree19mi",
                        "lod_largefurs07", "veg_largefurs05","veg_largefurs06",
                        "fuzzyplant256", "foliage256", "cypress1", "cypress2",
    }

--------------------------------
-- Switch effect on
--------------------------------
addEventHandler( "onClientResourceStart", resourceRoot,
    function()
    end
)

function enableGoundSnow()
    if bEffectEnabled then return end
    -- Version check
    if getVersion ().sortable < "1.1.1-9.03285" then
        outputChatBox( "Resource is not compatible with this client." )
        return
    end

    snowShader = dxCreateShader ( "snow_ground.fx", 0, maxEffectDistance )
    treeShader = dxCreateShader( "snow_trees.fx" )
    naughtyTreeShader = dxCreateShader( "snow_naughty_trees.fx" )
    sNoiseTexture = dxCreateTexture( "smallnoise3d.dds" )

    if not snowShader or not treeShader or not naughtyTreeShader or not sNoiseTexture then
        --outputChatBox( "Could not create shader. Please use debugscript 3" )
        return nil
    end

    -- Setup shaders
    dxSetShaderValue( treeShader, "sNoiseTexture", sNoiseTexture )
    dxSetShaderValue( naughtyTreeShader, "sNoiseTexture", sNoiseTexture )
    dxSetShaderValue( snowShader, "sNoiseTexture", sNoiseTexture )
    dxSetShaderValue( snowShader, "sFadeEnd", maxEffectDistance )
    dxSetShaderValue( snowShader, "sFadeStart", maxEffectDistance/2 )

    -- Process snow apply list
    for _,applyMatch in ipairs(snowApplyList) do
        engineApplyShaderToWorldTexture ( snowShader, applyMatch )
    end

    -- Process snow remove list
    for _,removeMatch in ipairs(snowRemoveList) do
        engineRemoveShaderFromWorldTexture ( snowShader, removeMatch )
    end

    -- Process tree apply list
    for _,applyMatch in ipairs(treeApplyList) do
        engineApplyShaderToWorldTexture ( treeShader, applyMatch )
    end

    -- Process naughty tree apply list
    for _,applyMatch in ipairs(naughtyTreeApplyList) do
        engineApplyShaderToWorldTexture ( naughtyTreeShader, applyMatch )
    end

    -- Init vehicle checker
    doneVehTexRemove = {}
    vehTimer = setTimer( checkCurrentVehicle, 100, 0 )
    removeVehTextures()

    -- Flag effect as running
    bEffectEnabled = true

    showHelp()
end

--------------------------------
-- Switch effect off
--------------------------------
function disableGoundSnow()
    if not bEffectEnabled then return end

    -- Destroy all elements
    destroyElement( sNoiseTexture  )
    destroyElement( treeShader )
    destroyElement( naughtyTreeShader )
    destroyElement( snowShader )

    killTimer( vehTimer )

    -- Flag effect as stopped
    bEffectEnabled = false
end


----------------------------------------------------------------
-- removeVehTextures
--      Keep effect off vehicles
----------------------------------------------------------------
local nextCheckTime = 0
local bHasFastRemove = getVersion().sortable > "1.1.1-9.03285"

addEventHandler( "onClientPlayerVehicleEnter", root,
    function()
        removeVehTexturesSoon ()
    end
)

-- Called every 100ms
function checkCurrentVehicle ()
    local veh = getPedOccupiedVehicle(localPlayer)
    local id = veh and getElementModel(veh)
    if lastveh ~= veh or lastid ~= id then
        lastveh = veh
        lastid = id
        removeVehTexturesSoon()
    end
    if nextCheckTime < getTickCount() then
        nextCheckTime = getTickCount() + 5000
        removeVehTextures()
    end
end

-- Called the players current vehicle need processing
function removeVehTexturesSoon ()
    nextCheckTime = getTickCount() + 200
end

-- Remove textures from players vehicle from effect
function removeVehTextures ()
    if not bHasFastRemove then return end

    local veh = getPedOccupiedVehicle(localPlayer)
    if veh then
        local id = getElementModel(veh)
        local vis = engineGetVisibleTextureNames("*",id)
        -- For each texture
        if vis then 
            for _,removeMatch in pairs(vis) do
                -- Remove for each shader
                if not doneVehTexRemove[removeMatch] then
                    doneVehTexRemove[removeMatch] = true
                    engineRemoveShaderFromWorldTexture ( snowShader, removeMatch )
                end
            end
        end
    end
end


----------------------------------------------------------------
-- Help message
----------------------------------------------------------------
function showHelp()
    if bShowHelp ~= nil then return end
    bShowHelp = true
    helpStartTime = getTickCount()
    setTimer( function() bShowHelp=false end, helpMessageTime, 1 )
end

addEventHandler( "onClientRender", root,
    function ()
        if bShowHelp then
            local age = getTickCount() - helpStartTime
            if ( age > helpMessageTime - 256 ) then
                age = helpMessageTime - age
            end
            age = math.min(math.max(0,age),255)
            local sx, sy = guiGetScreenSize()
            dxDrawText(helpMessage, sx/2-3, sy*helpMessageY, sx/2+2, 0, tocolor(0, 0, 0, age), 3, 'default', 'center' )
            dxDrawText(helpMessage, sx/2+3, sy*helpMessageY, sx/2+2, 0, tocolor(0, 0, 0, age), 3, 'default', 'center' )
            dxDrawText(helpMessage, sx/2, sy*helpMessageY, sx/2, 0, tocolor(255, 255, 0, age), 3, 'default', 'center' )
        end
    end
)


----------------------------------------------------------------
-- Unhealthy hacks
----------------------------------------------------------------
_dxCreateShader = dxCreateShader
function dxCreateShader( filepath, priority, maxDistance, bDebug )
    priority = priority or 0
    maxDistance = maxDistance or 0
    bDebug = bDebug or false

    -- Slight hack - maxEffectDistance doesn't work properly before build 3236 if fullscreen
    local build getVersion ().sortable:sub(9)
    local fullscreen not dxGetStatus ().SettingWindowed
    if build "03236" and fullscreen then
        maxDistance 0
    end

    return _dxCreateShader filepathprioritymaxDistancebDebug )
end


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
kokz120
Wysłany: 2016-12-19, 16:54


Luqas

.lua <3






Wiek: 25
Na forum: 3455 dni
Posty: 84
Nick w MP: Luqas

Piwa: 10

Respekt: 80

Witaj!

Podmieni?e? nazwy swoich plik?w shader?w, na takie jakie s? w skrypcie?

Podpis
Pomogłem? Postaw Piwo lub/i respekt ^^


 Mój Youtube (klik)
Moje skrypty:
- Pay'n'Spray -

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-19, 18:56


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Luqas, Czyli? ;d

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-19, 21:05


Luqas

.lua <3






Wiek: 25
Na forum: 3455 dni
Posty: 84
Nick w MP: Luqas

Piwa: 10

Respekt: 80

Jak by? da? rade, wstaw ca?y skrypt bo na tym kawa?ku nic nie moge zrobi?.
Potem zobaczymy co sie zepsu?o.

[ Dodano: 2016-12-19, 21:08 ]
Czy to nie czasem skrypt "Shader snow ground"?

[ Dodano: 2016-12-19, 21:31 ]
Dobra, sprawdzi?em. U mnie tw?j skrypt dzia?a prawid?owo z ogryginalnymi plikami shader?w.

My?l? ?e wina le?y po stronie twoich shader?w :)

Podpis
Pomogłem? Postaw Piwo lub/i respekt ^^


 Mój Youtube (klik)
Moje skrypty:
- Pay'n'Spray -

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-20, 15:23


Kalizman







Wiek: 23
Na forum: 3651 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Przyk?adowy m?j kod podmieniaj?cy tekstur?:

addEventHandler('onClientResourceStart'resourceRoot,
function()
shader dxCreateShader('shader.fx')
terrain dxCreateTexture('droga.jpg')
dxSetShaderValue(shader'gTexture'terrain)
engineApplyShaderToWorldTexture(shader'vegasroad1_256')
end)


Postaw piwo autorowi tego posta
 

 
Tagi: snieg
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku