I have a problem with this code and I need some help.
So when I am changing the weapon to AK47 the only thing I receive is spam on chat and I have no idea how to fix it.
It's only happening when I add engineImportTXD and engineReplaceModel. Without It everything works perfectly.
Can someone help me or give me some better ideas?
GM - DayZ
function wczytaj()
txd = engineLoadTXD ( "models/ak47.txd" )
dff = engineLoadDFF ( "models/ak47.dff" )
outputChatBox ( "wczytano podmianki" )
end
addEventHandler( "onClientResourceStart", getRootElement(), wczytaj )
function podmiankibronki ()
local bronka = getPlayerWeapon ( localPlayer )
if(getElementData(localPlayer,"currentweapon_1") == "AK47" and bronka == 31) then
engineImportTXD ( txd, 356 )
engineReplaceModel ( dff, 356 )
outputChatBox ( "wczytano ak47" )
end
end
addEventHandler( "onClientPlayerWeaponSwitch", localPlayer, podmiankibronki )