Jump to content

[HELP]Replace Weapon


Recommended Posts

Posted
function ReplaceWeapon ( ) 
  
txd = engineLoadTXD ( "m4.txd" ) 
engineImportTXD ( txd, 31 ) 
dff = engineLoadDFF ( "m4.dff", 31 ) 
engineReplaceModel ( dff, 31 ) 
end 
  
addEvent ( "replaceWeapon", true ) 
addEventHandler ( "replaceWeapon", getRootElement(), ReplaceWeapon ) 
  

This is right?

Posted

No.

You must put the weapon's world object ID into the object part which can be found from Map Editor by searching for "M4" or "Colt" or so.

I also prefer this:

addEventHandler("onClientResourceStart", resourceRoot, 
     function() 
          -- code 
     end 
) 

Or just leave the event off and only put the functions in the file, works.

Posted
No.

You must put the weapon's world object ID into the object part which can be found from Map Editor by searching for "M4" or "Colt" or so.

I also prefer this:

addEventHandler("onClientResourceStart", resourceRoot, 
     function() 
          -- code 
     end 
) 

Or just leave the event off and only put the functions in the file, works.

thnx dude you know Armor ID to replace?

Posted

JokeR,

- You know how to program in Lua? I guess not.

- You know the MTA Wiki? I guess not.

Solidsnake sent to you the functions. Why don't you read the Wiki and learn how to use the functions? Did you know that you can find the Weapon ID's on MTA Wiki?

We will not program for you. We will not work for you. If you want make something, go learn Lua. Is the better way. ;)

Posted
JokeR,

- You know how to program in Lua? I guess not.

- You know the MTA Wiki? I guess not.

Solidsnake sent to you the functions. Why don't you read the Wiki and learn how to use the functions? Did you know that you can find the Weapon ID's on MTA Wiki?

We will not program for you. We will not work for you. If you want make something, go learn Lua. Is the better way. ;)

I say i do it but don't know ID of ammo and can't find in wiki

  • 1 year later...
Posted

  
function applyMods() 
    local skin = engineLoadTXD("m4.txd", true) 
    engineImportTXD(skin, 356) 
    local skin = engineLoadDFF("m4.dff", 356) 
    engineReplaceModel(skin, 356) 
end 
addEventHandler("onClientResourceStart", resourceRoot, applyMods) 

<meta> 
<script src="scriptname.lua" /> 
</meta> 

Sorry for bumping an old topic, but I guess the guy seemed desperate and needed help.

Posted

Bumping over a year old topic for a small few lines of code is unnecessary. In fact, you can find that code in the Wiki and I know there are 100 other topics about how to import a custom texture on a weapon.

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