Jump to content

Skin replacement doesn't work


anybox

Recommended Posts

Hi, i have a problem with skin replacement. I have two folders. First containing 4 files: client.lua, meta.xml, model.dff, model.txd.

client.lua

function skins() 
    local modelId = 12 
    local txd = engineLoadTxd("model.txd") 
    engineImportTXD(txd, modelId) 
    local dff = engineLoadDFF("model.dff", modelId) 
    engineReplaceModel(dff, modelId) 
end 
addEventHandler("onClientResourceStart", resourceRoot, skins) 

meta.xml

<meta> 
    <script src='client.lua' type='client' /> 
    <file src='model.txd'/> 
    <file src='model.dff'/> 
</meta> 

And the second folder consists of two files: server.lua and meta.xml

server.lua

local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10 
  
function spawnOnJoin() 
    fadeCamera(source, true) 
    setCameraTarget(source, source) 
    outputChatBox("Welcome to boxya shit server", source) 
    spawnPlayer(source, spawnX, spawnY, spawnZ) 
end 
addEventHandler("onPlayerJoin", getRootElement(), spawnOnJoin) 
  
function setPlayerOnSpawn() 
    setElementModel(source, 12) 
end 
addEventHandler("onPlayerSpawn", getRootElement(), setPlayerOnSpawn) 

meta.xml

<meta> 
    <info author="test" type="gamemode" name="Team Server" description="My first mta server"/> 
  
    <script src="server.lua"/> 
</meta> 

I run the server and type two commands:

start myserver

start loadmodels

These resources succesfully loaded. I join the server and see no changes. The model is still current. So i don't know what is the problem. Help me to find solution. Thanks

Edited by Guest
Link to comment

No errors, no messages. debugscript is set to level 3. I suspect that onClientResourceStart doesn't work at all. I put outputConsole and outputChatBox commands to the start of my skins() function and saw no messages in the chat or console. Maybe something wrong with client.lua loading...

Edited by Guest
Link to comment
function skins ( ) 
    outputChatBox ( "SKIN REPLACEMENT LOADED" ) 
    local modelId = 12 
    local txd = engineLoadTXD ( "model.txd" ) 
    engineImportTXD ( txd, modelId ) 
    local dff = engineLoadDFF ( "model.dff", modelId ) 
    engineReplaceModel ( dff, modelId ) 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, skins ) 

See what it outputs to chatbox.

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