Plate Posted February 22, 2013 Share Posted February 22, 2013 Hola necesito una ayuda con este script me dice bad Argument @ setPedStat addEventHandler("onPlayerWasted", root, function() local weapons = convertWeaponsToJSON(source) setElementData(source,"tempWeapons",weapons) local s69 = getPedStat(source, 69) local s70 = getPedStat(source, 70) local s71 = getPedStat(source, 71) local s72 = getPedStat(source, 72) local s73 = getPedStat(source, 73) local s74 = getPedStat(source, 74) local s75 = getPedStat(source, 75) local s76 = getPedStat(source, 76) local s77 = getPedStat(source, 77) local s78 = getPedStat(source, 78) end ) addEventHandler("onPlayerSpawn", root, function () local weapons = getElementData(source,"tempWeapons") if (weapons) then giveWeaponsFromJSON(source, weapons) setPedStat(source, 69, s69) setPedStat(source, 70, s70) setPedStat(source, 71, s71) setPedStat(source, 72, s72) setPedStat(source, 73, s73) setPedStat(source, 74, s74) setPedStat(source, 75, s75) setPedStat(source, 76, s76) setPedStat(source, 77, s77) setPedStat(source, 78, s78) end end ) function convertWeaponsToJSON(player) local weaponSlots = 12 local weaponsTable = {} for slot=1, weaponSlots do local weapon = getPedWeapon( source, slot ) local ammo = getPedTotalAmmo( source, slot ) if (weapon > 0 and ammo > 0) then weaponsTable[weapon] = ammo end end return toJSON(weaponsTable) end function giveWeaponsFromJSON(player, weapons) if (weapons and weapons ~= "") then for weapon, ammo in pairs(fromJSON(weapons)) do if (weapon and ammo) then giveWeapon(player, tonumber(weapon), tonumber(ammo)) end end end Link to comment
Atouk Posted February 22, 2013 Share Posted February 22, 2013 Nose bien el error, pero creo que al ultimo te falta un "end" para cerrar la funcion "giveWeponsFromJSON" nose mucho de script, y vos lo sabes porque vos siempre me ayudas haha Link to comment
Plate Posted February 22, 2013 Author Share Posted February 22, 2013 No no le falta ningun end Link to comment
RekZ Posted February 22, 2013 Share Posted February 22, 2013 creo que tiene toda la razon el unico error que le veo yo es que le falta un "end" en essa funcion que dice... revisalo addEventHandler("onPlayerWasted", root, function() local weapons = convertWeaponsToJSON(source) setElementData(source,"tempWeapons",weapons) local s69 = getPedStat(source, 69) local s70 = getPedStat(source, 70) local s71 = getPedStat(source, 71) local s72 = getPedStat(source, 72) local s73 = getPedStat(source, 73) local s74 = getPedStat(source, 74) local s75 = getPedStat(source, 75) local s76 = getPedStat(source, 76) local s77 = getPedStat(source, 77) local s78 = getPedStat(source, 78) end ) addEventHandler("onPlayerSpawn", root, function () local weapons = getElementData(source,"tempWeapons") if (weapons) then giveWeaponsFromJSON(source, weapons) setPedStat(source, 69, s69) setPedStat(source, 70, s70) setPedStat(source, 71, s71) setPedStat(source, 72, s72) setPedStat(source, 73, s73) setPedStat(source, 74, s74) setPedStat(source, 75, s75) setPedStat(source, 76, s76) setPedStat(source, 77, s77) setPedStat(source, 78, s78) end end ) function convertWeaponsToJSON(player) local weaponSlots = 12 local weaponsTable = {} for slot=1, weaponSlots do local weapon = getPedWeapon( source, slot ) local ammo = getPedTotalAmmo( source, slot ) if (weapon > 0 and ammo > 0) then weaponsTable[weapon] = ammo end end return toJSON(weaponsTable) end function giveWeaponsFromJSON(player, weapons) if (weapons and weapons ~= "") then for weapon, ammo in pairs(fromJSON(weapons)) do if (weapon and ammo) then giveWeapon(player, tonumber(weapon), tonumber(ammo)) end -- para el if end -- para el for end -- para el if end -- para la function Link to comment
Plate Posted February 22, 2013 Author Share Posted February 22, 2013 No creo por que yo cuando lo usaba sin el "getPedStat" y el "setPedStat" andaba bien el problema es el getPedStat no las armas Link to comment
Castillo Posted February 22, 2013 Share Posted February 22, 2013 Que es lo que intentas hacer? Link to comment
Plate Posted February 22, 2013 Author Share Posted February 22, 2013 Ya esta arreglado solid muchas gracias a todos por contestar Link to comment
Recommended Posts