Jump to content

Can I add a custom object without replacing an object?


szekelymilan

Recommended Posts

Posted

Hi guys! I have a big problem on my server with road signs.
I want to add 192 road signs (custom objects) to my server, but when I wrote an unknown Object ID, it wasn't working.

THE SCRIPT:

addEventHandler('onClientResourceStart', resourceRoot,  
    function()  
        local txd = engineLoadTXD('files/kresz_es01.txd',true) 
        engineImportTXD(txd, 19998) 
        local dff = engineLoadDFF('files/kresz_es01.dff', 0)  
        engineReplaceModel(dff, 19998) 
        engineSetModelLODDistance(19998, 500) 
    end  
)

It's a very simple script.
I tried to change that id (19998) to a wire's id, and it was working, I was seeing it, but it's a big object by the server, and I couldn't move it a bit.

I have only TXD and DFF files, beacuse I downloaded an .img file for SA-MP and with an .img extractor, I extracted the files. (https://sampforum.hu/index.php?topic=32525.0) <- it says the object ids are 19808 -> 19999.
I know, there are tables in the editor, but there aren't 192 tables/road signs (only 8).
So please help me!

Can I create a new ID for objects?

Thanks,
MakroBox ;)

And sorry for my bad English! Bye!
 

Posted
8 minutes ago, Walid said:

No you can't.

But...

Go to a Hungarian Roleplay server. (like SeeMTA or ExternalGamkng) They can solve this... But in the GTA... there are only 8 objects is same sized with my road signs...

Posted
9 minutes ago, MakroBox said:

But...

Go to a Hungarian Roleplay server. (like SeeMTA or ExternalGamkng) They can solve this... But in the GTA... there are only 8 objects is same sized with my road signs...

Just change the object texture that's all.

Posted
8 hours ago, Walid said:

Just change the object texture that's all.

You don't understand. "the object": Can you send me a WORKING ID?

My problem: I change an object's texture, but if I changing a big object's texture I can't move it, only the size of the object (if my sign has 1 meter width and the object's 10 meter, i can move it only by 10 meters.)

And there's only max. 20 goodsized object! Only 20, for 192 road signs. How can I do that? Please! Help me.

Posted
47 minutes ago, Walid said:

I'm not talking about the TXD file, you don't need to replace 192 object , just replace only one object (maybe you need 2 objects depending on the signs ( triangle and circle)) then use: (dxCreateShaderdxCreateTexturedxSetShaderValueengineApplyShaderToWorldTexture), to change the signs texture.

I'm pretty sure, you don't undrestand what i'm talking about.

 

Oh. I have 7 different DFF files (triangle up, triangle down, circle, etc.)

And the TXD is the texture...

Can you send me a script, please, of your idea?

And in your idea... is TXD the trinagle up and etc. files and is the DFF the textures? Or what? And that's nice... you're amazing!

Thanks,

MakroBox

Posted
30 minutes ago, MakroBox said:

Can you send me a script, please, of your idea?

No try to do it by yourself then post your code here. here is an example with the same object ID: 1323

Before (Default texture)

9a56ea58c4.jpg

After ( the same object ID with different textures)

352175d106.jpg

  • Like 1
Posted
10 hours ago, Walid said:

No try to do it by yourself then post your code here. here is an example with the same object ID: 1323

Before (Default texture)

9a56ea58c4.jpg

After ( the same object ID with different textures)

352175d106.jpg

Okay, I make the object afternoon, thanks for the help!

I'm goin' to the Wiki now, to understand your "commands". (sry for bad English :D)

Thanks,

MakroBox

10 hours ago, ThatsMe said:

they use shaders to apply different texture to an ONE model

model can replace anything that is unused (Eg: unused brothel interiors or something)

No! If I replace an interior... the road sign is okay (at the client), but by the server's idea it's a big object, and I can't move it, etc. I have to replace it to a road sign (beacuse I want a road sign)... Like 1323 OBJECT ID... See Walid's comment.

Posted (edited)
10 hours ago, Walid said:

No try to do it by yourself then post your code here. here is an example with the same object ID: 1323

Before (Default texture)

9a56ea58c4.jpg

After ( the same object ID with different textures)

352175d106.jpg

I can't... Sorry. I don't know what is shader in MTA. I'm using Google about 30 minutes ago, but there aren't any good description...

And have I to use the WorldTexture "command"? Beacuse I don't want to change a world texture... (I think, the world texture is the world objects' texture. And the texture is the objects' texture. But if not, correct me.)

I'm a basic scripter... very basic. But, I wrote a nice bank system, but this... I can't. :(

Thanks,

MakroBox ;)

EDIT: .fx file??? How can I create it? :)

EDIT2: Is it a programming language? Oh my god....

Edited by MakroBox
Posted

Here is the fx file

//-- Declare the texture. These are set using dxSetShaderValue( shader, "Tex0", texture )
texture Tex0;
 
technique simple
{
    pass P0
    {
        //-- Set up texture stage 0
        Texture[0] = Tex0;
 
        //-- Leave the rest of the states to the default settings
    }
}

 

Posted
34 minutes ago, Walid said:

Here is the fx file


//-- Declare the texture. These are set using dxSetShaderValue( shader, "Tex0", texture )
texture Tex0;
 
technique simple
{
    pass P0
    {
        //-- Set up texture stage 0
        Texture[0] = Tex0;
 
        //-- Leave the rest of the states to the default settings
    }
}

 

Oh, it's okay, but I only need one fx file? I think I need 2 or more fx file, to change the texture.
I'm leading off the script.

Posted
21 minutes ago, MakroBox said:

Oh, it's okay, but I only need one fx file? I think I need 2 or more fx file, to change the texture.
I'm leading off the script.

Why you need two fx (shader) files ???

Posted
56 minutes ago, Walid said:

Why you need two fx (shader) files ???

Do I need? I think I need, beacuse one shader for the first texture and one more shader for the second texture. Or not?
Help me, please! :D
 

Posted
Just now, MakroBox said:

Do I need? I think I need, beacuse one shader for the first texture and one more shader for the second texture. Or not?
Help me, please! :D
 

lol :P you can use the same shader with multiple textures.

Posted
1 minute ago, MakroBox said:

Oh, thanks!!
And you copied the .fx file from here. :)

Ofc if you want to replace world textures with engineApplyShaderToWaorldTexture you need to use it.

Posted

This is my script...
I think it's bad, but.
I can make that...

 

addEventHandler('onClientResourceStart', resourceRoot, 
	function()
		local dff = engineLoadDFF('files/kresz01.dff', 0)  
        engineReplaceModel(dff, 1323) 
        engineSetModelLODDistance(1323, 500) 
		local myShader = dxCreateShader('files/shader.fx')
	end
)

function first()
	local txd = engineLoadTXD('files/kresz_es01.txd')
	dxSetShaderValue( myShader, "1323", txd )
end

function second()
	local txd = engineLoadTXD('files/kresz_es02.txd')
	dxSetShaderValue( myShader, "1323", txd )
end


addCommandHandler ( "kresz011", first )
addCommandHandler ( "kresz012", second )

 

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