i have here a shaders mod that i get in another forum
i dont remember the autor name (sr XD)
here the script
its works when i walk in area of shader
but it dosent work when i use
doSendPlayerExtendedOpcode(cid, 124, 10)
plx help me to make opcodes send to client a msg ho make shader activate!
+D
i dont remember the autor name (sr XD)
here the script
Code:
MAP_SHADERS = {
{ name = 'Default', frag = '/shaders/default.frag' },
-- { name = 'Bloom', frag = '/shaders/bloom.frag'},
{ name = 'Sepia', frag ='/shaders/sepia.frag' },
{ name = 'Grayscale', frag ='/shaders/grayscale.frag' },
{ name = 'Flash', frag ='/shaders/flash.frag' },
-- { name = 'Pulse', frag = '/shaders/pulse.frag' },
{ name = 'Old Tv', frag = '/shaders/oldtv.frag' },
{ name = 'Fog', frag = '/shaders/fog.frag', tex1 = '/shaders/clouds.png' },
{ name = 'Fog1', frag = '/shaders/fog1.frag', tex1 = '/shaders/clouds1.png' },
{ name = 'Fog2', frag = '/shaders/fog2.frag', tex1 = '/shaders/clouds2.png' },
{ name = 'Party', frag = '/shaders/party.frag' },
{ name = 'Radial Blur', frag ='/shaders/radialblur.frag' },
-- { name = 'Heat', frag ='/shaders/heat.frag' },
-- { name = 'Heat1', frag ='/shaders/heat1.frag' },
-- { name = 'Noise', frag ='/shaders/noise.frag' },
{ name = 'Zomg', frag ='/shaders/zomg.frag' },
{ name = 'Inverted', frag = '/shaders/inverted.frag' },
{ name = 'Rain', frag ='/shaders/rain.frag', tex1 = '/shaders/rain.png' },
}
GENJUTSU_SHADERS =
{
[0] = 'Default',
[1] = 'Bloom',
[2] = 'Grayscale',
[3] = 'Radial Blur',
[4] = 'Fog',
[5] = 'Pulse',
[6] = 'Old Tv',
[7] = 'Zomg',
[8] = 'Heat',
[9] = 'Noise',
[10] = 'Inverted',
[11] = 'Rain',
[12] = 'Del',
}
local areas = {
-- {from = {x = 1176, y = 1235, z = 7}, to = {x = 1185, y = 1243, z = 7}, name = 'fog'},
-- {from = {x = 1176, y = 1220, z = 7}, to = {x = 1185, y = 1238, z = 7}, name = 'Bloom'},
-- {from = {x = 1176, y = 1220, z = 7}, to = {x = 1185, y = 1233, z = 7}, name = 'Sepia'},
{from = {x = 1177, y = 1213, z = 7}, to = {x = 1182, y = 1216, z = 7}, name = 'Inverted'},
{from = {x = 1177, y = 1198, z = 7}, to = {x = 1182, y = 1201, z = 7}, name = 'Radial Blur'},
{from = {x = 1177, y = 1187, z = 7}, to = {x = 1182, y = 1190, z = 7}, name = 'Zomg'},
}
function isInRange(pos, fromPos, toPos)
return
pos.x>=fromPos.x and
pos.y>=fromPos.y and
pos.z>=fromPos.z and
pos.x<=toPos.x and
pos.y<=toPos.y and
pos.z<=toPos.z
end
function init()
if not g_graphics.canUseShaders() then return end
local player = g_game.getLocalPlayer()
for _i,opts in pairs(MAP_SHADERS) do
local shader = g_shaders.createFragmentShader(opts.name, opts.frag)
if opts.tex1 then
shader:addMultiTexture(opts.tex1)
end
if opts.tex2 then
shader:addMultiTexture(opts.tex2)
end
end
connect(LocalPlayer, {
onGenjutsuChange = onGenjutsuChange,
})
connect(LocalPlayer, {
onPositionChange = updatePosition
})
ProtocolGame.registerExtendedOpcode(124,
function (protocol, opcode, buffer)
shaderID = buffer
if(GENJUTSU_SHADERS[shaderID])then
local map = modules.game_interface.getMapPanel()
if(shaderID <= 0) then
map:setMapShader(g_shaders.getShader('Default'))
else
map:setMapShader(g_shaders.getShader(GENJUTSU_SHADERS[shaderID]))
end
end
end
)
local map = modules.game_interface.getMapPanel()
map:setMapShader(g_shaders.getShader('Default'))
end
function onGenjutsuChange(localPlayer, genjutsuId)
end
function terminate()
disconnect(LocalPlayer, {
onGenjutsuChange = changeGenjutsu,
})
ProtocolGame.unregisterExtendedOpcode(124)
end
function updatePosition()
local player = g_game.getLocalPlayer()
if not player then return end
local pos = player:getPosition()
if not pos then return end
local name = 'Default'
local map = modules.game_interface.getMapPanel()
if hasSqmUp(pos) then
map:setMapShader(g_shaders.getShader(name))
return true
end
for _, TABLE in ipairs(areas) do
if isInRange(pos, TABLE.from, TABLE.to) then
name = TABLE.name
end
end
map:setMapShader(g_shaders.getShader(name))
end
function hasSqmUp(posi)
local pos = {x = posi.x, y = posi.y, z = posi.z-1}
local thing = g_map.getTile(pos)
return thing and true or false
end
its works when i walk in area of shader
but it dosent work when i use
doSendPlayerExtendedOpcode(cid, 124, 10)
plx help me to make opcodes send to client a msg ho make shader activate!
+D
Last edited: