Aruna Posted September 28, 2014 Share Posted September 28, 2014 Hola a todos, quisiera saber a que viene este Problemita en la Game Mode de Dayz y como podria solucionarlo ya que esto me consume mucha ram del hosting. function weaponSwitchBack(previousWeaponID, currentWeaponID) local weapon1 = getElementData(source, "currentweapon_1") if not weapon1 then return end local ammoData1, weapID1 = getWeaponAmmoType(weapon1) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then setElementID(player, "elementWeaponBack[source]") detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1), x, y, z) setObjectScale(elementWeaponBack[source], 0.875) if elementBackpack[source] then attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.31, -0.1, 0, 270, -90) else attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.11, -0.1, 0, 270, 10) end elseif currentWeaponID == weapID1 then setElementID(player, elementWeaponBack[source]) detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end desde ya muchas Gracias Link to comment
Tomas Posted September 28, 2014 Share Posted September 28, 2014 function weaponSwitchBack(previousWeaponID, currentWeaponID) local weapon1 = getElementData(source, "currentweapon_1") if not weapon1 then return end local ammoData1, weapID1 = getWeaponAmmoType(weapon1) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then setElementID(player, "elementWeaponBack[source]") detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1), x, y, z) setObjectScale(elementWeaponBack[source], 0.875) if elementBackpack[source] then attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.31, -0.1, 0, 270, -90) else attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.11, -0.1, 0, 270, 10) end elseif currentWeaponID == weapID1 then setElementID(player, tostring(elementWeaponBack[source])) detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end Link to comment
Aruna Posted September 29, 2014 Author Share Posted September 29, 2014 function weaponSwitchBack(previousWeaponID, currentWeaponID) local weapon1 = getElementData(source, "currentweapon_1") if not weapon1 then return end local ammoData1, weapID1 = getWeaponAmmoType(weapon1) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then setElementID(player, "elementWeaponBack[source]") detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1), x, y, z) setObjectScale(elementWeaponBack[source], 0.875) if elementBackpack[source] then attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.31, -0.1, 0, 270, -90) else attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.11, -0.1, 0, 270, 10) end elseif currentWeaponID == weapID1 then setElementID(player, tostring(elementWeaponBack[source])) detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end Este Seria editado con la cadena de tostring Tomas?? Link to comment
Bc# Posted September 29, 2014 Share Posted September 29, 2014 Obvio, te el segundo argumento pedía un string y tu le entregabas un object. Link to comment
Aruna Posted September 29, 2014 Author Share Posted September 29, 2014 function weaponSwitchBack(previousWeaponID, currentWeaponID) local weapon1 = getElementData(source, "currentweapon_1") if not weapon1 then return end local ammoData1, weapID1 = getWeaponAmmoType(weapon1) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then setElementID(player, "elementWeaponBack[source]") detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1), x, y, z) setObjectScale(elementWeaponBack[source], 0.875) if elementBackpack[source] then attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.31, -0.1, 0, 270, -90) else attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.11, -0.1, 0, 270, 10) end elseif currentWeaponID == weapID1 then setElementID(player, tostring(elementWeaponBack[source])) detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end Gracias Tomas me sirvio. Obvio, te el segundo argumento pedía un string y tu le entregabas un object. Gracias bc Link to comment
Aruna Posted September 29, 2014 Author Share Posted September 29, 2014 Igual al colocar el string ahora me dice que no puede encontrar al argumento 1 function weaponSwitchBack(previousWeaponID, currentWeaponID) local weapon1 = getElementData(source, "currentweapon_1") if not weapon1 then return end local ammoData1, weapID1 = getWeaponAmmoType(weapon1) local x, y, z = getElementPosition(source) local rx, ry, rz = getElementRotation(source) if previousWeaponID == weapID1 then if elementWeaponBack[source] then setElementID(player, "elementWeaponBack[source]") detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end elementWeaponBack[source] = createObject(getWeaponObjectID(weapID1), x, y, z) setObjectScale(elementWeaponBack[source], 0.875) if elementBackpack[source] then attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.31, -0.1, 0, 270, -90) else attachElementToBone(elementWeaponBack[source], source, 3, 0.19, -0.11, -0.1, 0, 270, 10) end elseif currentWeaponID == weapID1 then setElementID(player, tostring(elementWeaponBack[source])) detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end end Link to comment
Tomas Posted September 29, 2014 Share Posted September 29, 2014 ¿En qué linea? De este foro. Link to comment
Aruna Posted September 29, 2014 Author Share Posted September 29, 2014 ¿En qué linea? De este foro. Línea 24 Link to comment
Tomas Posted September 29, 2014 Share Posted September 29, 2014 Hmm, la verdad es un poco raro porque arriba lo crea y debajo lo destruye, no veo el problema. Link to comment
Mr.Aleks Posted September 30, 2014 Share Posted September 30, 2014 No defines player. Link to comment
Aruna Posted September 30, 2014 Author Share Posted September 30, 2014 No defines player. como defino player con source o theplayer?? Link to comment
Mr.Aleks Posted September 30, 2014 Share Posted September 30, 2014 Donde pones "player" pon "source". Link to comment
Recommended Posts