Jump to content

Overdose effects! HELP


Xwad

Recommended Posts

  • MTA Team

Warning: I forgot that particles might not have a model id, which you can replace (others please report your knowledge) and it might be only possible with shaders?

You probably can't replace .fxp files, but you can replace .txd files (.

Your resource needs a clientside script (that script will be downloaded by every player [automatically] and it will be run on the MTA client). Let's call this script client.lua (place it in your resource folder)

Your server needs to know that it should transfer the client.lua to each client. To archive that you have to add the script to your meta.xml

<meta> 
    <info author="Xwad" /> 
    <file src="effects.fxp" /> 
    <file src="effectsPC.txd" /> 
    <file src="particle.txd" /> 
    <script src="client.lua" /> 
</meta> 

So far so good, but the clientscript is empty. Now to replace the files you have to use those functions when the resource starts:

But how do you know when a resource actually starts? For that purpose you have to use the event system.

  
function whenMyResourceStarts() 
    -- Probably not possible, because particles might not have a special model id (i don't know, lol) 
    local txd = engineLoadTXD( "effectsPC.txd" ) 
    engineImportTXD( txd, 1 ) 
    txd = engineLoadTXD( "particle.txd" ) 
    engineImportTXD( txd, 1 ) 
end 
addEventHandler("onClientResourceStart", resourceRoot, whenMyResourceStarts) 
  

Link to comment

I'm not sure if it's possible to change effects , but try this;

1. Login in your account (you need to be admin)

2. Open F8 and write "debugscript 3"

3. Restart the resource, and check does debugscript 3 output something about your resource.

@EDIT: the functions engineLoadTXD and engineImportTXD work only for the gta3.img, effects are in models folder,so you can't change effects. Use shaders.

Link to comment
  • 1 month later...

Try this, replace the names.

addEventHandler( "onClientResourceStart", resourceRoot, 
    function() 
        if getVersion ().sortable < "1.1.0" then 
            outputChatBox( "resource wont work on this client." ) 
            return 
        end 
  
texShader = dxCreateShader ( "effects.fx" ) 
siteM16 = dxCreateTexture("hud/siteM16.png") 
  
  
dxSetShaderValue(texShader,"gTexture",siteM16) 
engineApplyShaderToWorldTexture(texShader,"siteM16") 
        end 
) 

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...