Atouk Posted January 1, 2014 Share Posted January 1, 2014 Disculpen comunidad por molestar de nuevo, pero tengo un problema medio grave que es no poder equipar armas de la tabla others, el error esta en la linea 39, argumento 2(ammoData). script: weaponAmmoTable = { ["Makarov Mag"] = {{"Makarov PM", 22}}, ["M9SD Mag"] = {{"M9 SD", 23}}, [".45 ACP"] = {{"Revolver", 24}}, ["PDW Mag"] = {{"PDW", 28}}, ["MP5 Mag"] = {{"MP5A5", 29}}, ["30Rnd. AK"] = {{"AKS-74 Kobra", 30}}, ["30Rnd. STANAG"] = {{"M4A1 CCO", 31}}, ["8Rnd. Slugs"] = {{"Remington 870", 25}}, ["2Rnd. Slug"] = {{"Sawn-Off Shotgun", 26}}, ["SPAZ-12 Pellet"] = {{"SPAZ-12 Combat Shotgun", 27}}, ["DMR Mag"] = {{"DMR", 34}}, ["5Rnd. M24"] = {{"M14 AIM", 33}}, ["M136 Rocket"] = {{"Heat-Seeking RPG", 36},{"M136 Rocket Launcher", 35}}, ["others"] = {{"Parachute", 46},{"Satchel", 39},{"Tear Gas", 17},{"M67 Frag Grenade", 16},{"Hunting Knife", 4},{"Machete", 8},{"Binoculars", 43},{"Baseball Bat", 5},{"Hatchet", 2},{"Shovel", 6},{"Crowbar", 7}} } function getWeaponAmmoType ( weaponName ) for i, weaponData in ipairs ( weaponAmmoTable.others ) do if ( weaponName == weaponData [ 2 ] ) then return weaponData [ 1 ], weaponData [ 2 ] end end local ammoName, id = false, false for ammo, data in pairs ( weaponAmmoTable ) do if ( data [ 1 ] [ 1 ] == weaponName ) then ammoName, id = ammo, data [ 1 ] [ 2 ] break end end return ammoName, id end function rearmPlayerWeapon(weaponName, slot) takeAllWeapons(source) local ammoData, weapID = getWeaponAmmoType(weaponName) if getElementData(source, ammoData) <= 0 then triggerClientEvent(source, "displayClientInfo", source, "Rearm", shownInfos.nomag, 255, 22, 0) return end setElementData(source, "currentweapon_" .. slot, weaponName) local weapon = getElementData(source, "currentweapon_1") if weapon then local ammoData, weapID = getWeaponAmmoType(weapon) giveWeapon(source, weapID, getElementData(source, ammoData), true) triggerClientEvent( source, "playSoundEquipPrimary", source ) end local weapon = getElementData(source, "currentweapon_2") if weapon then local ammoData, weapID = getWeaponAmmoType(weapon) giveWeapon(source, weapID, getElementData(source, ammoData), false) triggerClientEvent( source, "playSoundEquipSecondary", source ) end local weapon = getElementData(source, "currentweapon_3") if weapon then local ammoData, weapID = getWeaponAmmoType(weapon) giveWeapon(source, weapID, getElementData(source, ammoData), false) triggerClientEvent( source, "playSoundEquipSpecial", source ) end if elementWeaponBack[source] then detachElementFromBone(elementWeaponBack[source]) destroyElement(elementWeaponBack[source]) elementWeaponBack[source] = false end setElementModel(source, getElementData(source, "skin")) end addEvent("onPlayerRearmWeapon", true) addEventHandler("onPlayerRearmWeapon", getRootElement(), rearmPlayerWeapon) Link to comment
Atouk Posted January 2, 2014 Author Share Posted January 2, 2014 Porfavor, si alguien tiene alguna idea que la poste, gracias.. Link to comment
MTA Team 0xCiBeR Posted January 3, 2014 MTA Team Share Posted January 3, 2014 Proba así: PD: Estoy casi seguro que no funcionara, pero bueno, vale la pena intentarlo. function getWeaponAmmoType ( weaponName ) for i, weaponData in ipairs ( weaponAmmoTable.others ) do if ( weaponName == weaponData [ 1 ] ) then return weaponData [ 1 ], weaponData [ 2 ] end end local ammoName, id = false, false for ammo, data in pairs ( weaponAmmoTable ) do if ( data [ 1 ] [ 1 ] == weaponName ) then ammoName, id = ammo, data [ 1 ] [ 2 ] break end end return ammoName, id end Link to comment
Atouk Posted January 3, 2014 Author Share Posted January 3, 2014 Che te vas a enojar conmigo si te insulto?, porque sos un verdadero ídolo para mi!, cambiaste un numero y listo. Otro mas que me hace feliz luego de tiempo un capo me arreglo el ultimo bug de mi server, Muchas gracias Cib3R!!!!! ÍDOLO!! Fuegos artificiales para vos!, fiuuu boom fiuuu boom Link to comment
MTA Team 0xCiBeR Posted January 3, 2014 MTA Team Share Posted January 3, 2014 Jaja De nada, un gusto ayudarte de verás Link to comment
Recommended Posts