
Tycka
Members-
Posts
53 -
Joined
-
Last visited
Everything posted by Tycka
-
Hello I find that code: local nearbyPlayers = {} addEventHandler( 'onPlayerVoiceStart', root, function() local chatRadius = 10 local posX, posY, posZ = getElementPosition( source ) local chatSphere = createColSphere( posX, posY, posZ, chatRadius ) nearbyPlayers = getElementsWithinColShape( chatSphere, "player" ) destroyElement( chatSphere ) local empty = exports.voice:getNextEmptyChannel ( ) exports.voice:setPlayerChannel(source, empty) for index, player in ipairs (nearbyPlayers) do exports.voice:setPlayerChannel(player, empty) end end) addEventHandler("onPlayerVoiceStop",root, function() exports.voice:setPlayerChannel(source) for index, player in ipairs (nearbyPlayers) do exports.voice:setPlayerChannel(player) end nearbyPlayers = {} end) That code must do voice chat local but it don't work what wrong?
-
Hello, how to set shall be heard 10M radius. Not global but hear local players
-
Fixed. Thanks who try help
-
Just use it in the client-side and boom it works. (if isElementAttachedToBone is defined on client-side too) When I use it on client side them I dont get any error or warning, but them code didint work
-
Now I get this: Bad argument @ 'getPedWeaponSlot'
-
No, using at server side.
-
local alpha = 255 bindKey ( "aim_weapon", "both", function ( _, state ) if getPedWeaponSlot ( localPlayer ) == 6 then if ( state == "down" ) then alpha = 0 elseif ( state == "up" ) then alpha = 255 end for _, v in ipairs ( getElementsByType ( "object", root, true ) ) do if isElementAttachedToBone ( v ) then local id = getElementModel ( v ) if ( id == 1853 ) then setElementAlpha ( v, alpha ) end end end end end ) That DayZ code and when I start resource I get that warning: Bad argument @ 'bindKey' What wrong?
-
UP. Help someone pls.
-
function weaponSwitch(weapon) local wpn = getElementData(getLocalPlayer(), "currentweapon_1") if source == getLocalPlayer() then if wpn == "Sawn-Off Shotgun" then if getElementData(getLocalPlayer(), "2Rnd. Slug") > 0 then setElementData(getLocalPlayer(), "2Rnd. Slug", getElementData(getLocalPlayer(), "2Rnd. Slug") - 1) end else local ammoName, _ = getWeaponAmmoType2(weapon) if getElementData(getLocalPlayer(), ammoName) > 0 then setElementData(getLocalPlayer(), ammoName, getElementData(getLocalPlayer(), ammoName) - 1) end end end end When I use this its work great, when I add elseif wpn == "AS50" then if getElementData(getLocalPlayer(), "AS50 Mag") > 0 then setElementData(getLocalPlayer(), "AS50 Mag", getElementData(getLocalPlayer(), "AS50 Mag") - 1) end Them code didint work
-
function weaponSwitch(weapon) local wpn = getElementData(getLocalPlayer(), "currentweapon_1") if source == getLocalPlayer() then if wpn == "Sawn-Off Shotgun" then if getElementData(getLocalPlayer(), "2Rnd. Slug") > 0 then setElementData(getLocalPlayer(), "2Rnd. Slug", getElementData(getLocalPlayer(), "2Rnd. Slug") - 1) end elseif wpn == "AS50" then if getElementData(getLocalPlayer(), "AS50 Mag") > 0 then setElementData(getLocalPlayer(), "AS50 Mag", getElementData(getLocalPlayer(), "AS50 Mag") - 1) end else local ammoName, _ = getWeaponAmmoType2(weapon) if getElementData(getLocalPlayer(), ammoName) > 0 then setElementData(getLocalPlayer(), ammoName, getElementData(getLocalPlayer(), ammoName) - 1) end end end end
-
Error line: setElementData(source, "name", getElementData(source, "name") + 1) Error: ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:893: attempt to perform arithmetic on a boolean value FIXED.
-
Error line: setElementData(source, "name", getElementData(source, "name") + 1) Error: ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:893: attempt to perform arithmetic on a boolean value
-
Code: function getSkinIDFromName(name) for i, skin in ipairs(skinTable) do if name == skin[1] then return skin[2] end end end function getSkinNameFromID(id) for i, skin in ipairs(skinTable) do if id == skin[2] then return skin[1] end end end function addPlayerSkin(skin) local current = getElementData(source, "skin") local name = getSkinNameFromID(current) setElementData(source, name, getElementData(source, name) + 1) setElementData(source, skin, getElementData(source, skin) - 1) local id = getSkinIDFromName(skin) setElementData(source, "skin", id) setElementModel(source, id) triggerClientEvent(source, "refreshInventoryManual", source) end addEvent("onPlayerChangeSkin", true) addEventHandler("onPlayerChangeSkin", getRootElement(), addPlayerSkin) Error: [2014-10-07 22:58:46] WARNING: [DayZ-MTA]\DayZ\survivorSystem.lua:892: Bad argument @ 'getElementData' [Expected string at argument 2, got nil] [2014-10-07 22:58:46] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:892: attempt to perform arithmetic on a boolean value [2014-10-07 22:58:46] WARNING: [DayZ-MTA]\DayZ\survivorSystem.lua:892: Bad argument @ 'getElementData' [Expected string at argument 2, got nil] [2014-10-07 22:58:46] ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:892: attempt to perform arithmetic on a boolean value
-
Code: for i, weaponData in ipairs(weaponAmmoTable["30Rnd STANAG SD Mag"]) do if weaponName == weaponData[1] then return "30Rnd STANAG SD Mag", weaponData[2] end end error: ERROR: [DayZ-MTA]\DayZ\survivorSystem.lua:276: bad argument #1 to 'ipairs' (table expected, got nil)
-
That code mod same sound for all 3 snipers. I want mode 3 sniper with different sounds. I think I need check sniper by name (But I dont know how.)
-
addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), function(id) local x, y, z = getPedWeaponMuzzlePosition(source) if id == 34 then local sound = playSound3D('sounds/as50.waw', x, y, z) setSoundMaxDistance(sound, 50) end end Still now working. That work but I can't use different sounds on 3 differents snipers. function disableSounds() setAmbientSoundEnabled( "gunfire", false ) end addEventHandler("onClientResourceStart",root,disableSounds) local function playGunfireSound(weaponID) local muzzleX, muzzleY, muzzleZ = getPedWeaponMuzzlePosition(source) local px, py, pz = getElementPosition ( source ) elseif weaponID == 34 then local sound = playSound3D("sounds/as50.waw", muzzleX, muzzleY, muzzleZ, false) setSoundMaxDistance(sound, 40) end end addEventHandler("onClientPlayerWeaponFire", root, playGunfireSound)
-
yes, I have. Here how I use it. addEventHandler('onClientPlayerWeaponFire', getLocalPlayer(), function(1) local x, y, z = getPedWeaponMuzzlePosition(source) if id == 34 then local sound = playSound3D('sounds/as50.waw', x, y, z) setSoundMaxDistance(sound, 50) end end And I have 3 sniper in 34Id, but with other object.
-
Can you give some example?
-
Hello, I have problem with new weapon sounds, I add some new items but how use new sounds to new weapons(I using new object on original weapon and dublicate it)? pls help, gamemode Dayz. And problem with snipers here is foto: http://i60.tinypic.com/2ufqb77.png