Jump to content

2 questions about scripts


tim260

Recommended Posts

Posted

first off can someone see what wrong to the code below so thats the first question :P

function createTeamsOnStart () 
    teamPolice = createTeam ( "Police", 0, 0, 255 ) 
    teamRobber = createTeam ( "Robber", 255, 0, 0 ) 
    teamMechanics = createTeam ( "Mechanics", 0, 255, 0 ) 
    teamWhores = createTeam ( "Whores", 255, 0, 255 ) 
    teamPilot = createTeam ( "Pilot", 255, 255, 0 ) 
    teamTruker = createTeam ( "Trucker", 192, 192, 192 ) 
    teamNubcaker = createTeam ( "Nubcaker INC.", 192, 192, 192 ) 
    teamDealers = createTeam ( "Dealers", 255, 0, 0 ) 
    teamMilitary = createTeam ( "Military", 0, 255, 0 ) 
    teamNaval = createTeam ( "Naval", 0, 255, 0 ) 
    teamSecurity = createTeam ( "Security", 0, 255, 0 ) 
    teamSecurity = createTeam ( "investors", 255, 255, 0 ) 
    teamGuests = createTeam ( "Guests", 255, 255, 0 ) 
  
end 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), createTeamsOnStart  ) 

Second question,

Is it possible to replace weapons i tried it with the

engineLoadDFF 
engineLoadTXD 

but it didnt work so can someone explain it to me.

Posted

can you tell what error you get in the team script (use /debugscript 3)

Ingame Name : |DGT|Puma

DGT Clan Server 24/7 Owner/Scripter

MultiGameMode in progress :

n-560x95_FFFFFF_FFFFFF_0283C4_000000.png

Posted

1): Check if your meta.xml in the script of teams is type="server".

2): Use this:

function load() 
    txd = engineLoadTXD ("m4.txd" ) 
    engineImportTXD ( txd, 356 ) 
    dff = engineLoadDFF ( "m4.dff", 0 ) 
    engineReplaceModel ( dff, 356 ) 
end 
  
addEventHandler("onClientResourceStart",resourceRoot, 
function () 
    local version = getVersion() 
    if string.find(version.mta, "1.1.1") then 
        setTimer ( load, 1000, 1) 
    end 
end) 

The script for weapon replacement must be type="client" in meta.xml.

You can only replace weapons, skin models in MTA 1.1.1, not 1.1.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Thanks solid snake the create teams works :D ( i should have someone like you in my team for the server LOl ) :P, but the weapon replacement isnt working

Posted

I'm guessing you changed the weapon model, file name(s), right?

Post your new script + meta.xml of it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Yes i changed it ;p

function load()  
  txd = engineLoadTXD("gun.txd", 31 ) 
  engineImportTXD(txd, 31) 
  dff = engineLoadDFF("gun.dff", 31 ) 
  engineReplaceModel(dff, 31) 
end 
  
addEventHandler("onClientResourceStart",resourceRoot, 
function () 
    local version = getVersion() 
    if string.find(version.mta, "1.1.1") then 
        setTimer ( load, 1000, 1) 
    end 
end) 

  
 
   type="script" version="1.0" author="tim"/>  
   

Posted

See? you changed my script, you didn't read how it worked.

You must use the weapon OBJECT model ID's not the weapon model ID.

You can find weapon OBJECT model in this link: https://wiki.multitheftauto.com/wiki/Weapons

-- client.lua

function load() 
  txd = engineLoadTXD("gun.txd", 356 ) 
  engineImportTXD(txd, 356) 
  dff = engineLoadDFF("gun.dff", 0 ) -- IT HAS TO BE 0 IF NOT REPLACING A VEHICLE. 
  engineReplaceModel(dff, 356) 
end 
  
addEventHandler("onClientResourceStart",resourceRoot, 
function () 
    local version = getVersion() 
    if string.find(version.mta, "1.1.1") then 
        setTimer ( load, 1000, 1) 
    end 
end) 

-- meta.xml:

   type="script" version="1.0" author="tim"/> 
   

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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