Sticmy Posted January 10, 2017 Share Posted January 10, 2017 Hola chicos, quisiera saber porqué cuando un jugador muere, les aumenta la munición de las armas, intente resolverlo pero no pude, y el BUG sigue me molesta mucho en mi servidor, Les dejo el código. function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth, attacker) if not( isGuestAccount (getPlayerAccount(source)) ) then local theWeapon = getPedWeapon (source) local theWeapon1 = getPedWeapon (source, 1) local theWeapon2 = getPedWeapon (source, 2) local theWeapon3 = getPedWeapon (source, 3) local theWeapon4 = getPedWeapon (source, 4) local theWeapon5 = getPedWeapon (source, 5) local theWeapon6 = getPedWeapon (source, 6) local theWeapon7 = getPedWeapon (source, 7) local theWeapon8 = getPedWeapon (source, 8) local theWeapon9 = getPedWeapon (source, 9) local theWeapon10 = getPedWeapon (source, 10) local theWeapon11 = getPedWeapon (source, 11) local theWeapon12 = getPedWeapon (source, 12) local weaponAmmo = getPedTotalAmmo (source) local weaponAmmo1 = getPedTotalAmmo (source, 1) local weaponAmmo2 = getPedTotalAmmo (source, 2) local weaponAmmo3 = getPedTotalAmmo (source, 3) local weaponAmmo4 = getPedTotalAmmo (source, 4) local weaponAmmo5 = getPedTotalAmmo (source, 5) local weaponAmmo6 = getPedTotalAmmo (source, 6) local weaponAmmo7 = getPedTotalAmmo (source, 7) local weaponAmmo8 = getPedTotalAmmo (source, 8) local weaponAmmo9 = getPedTotalAmmo (source, 9) local weaponAmmo10 = getPedTotalAmmo (source, 10) local weaponAmmo11 = getPedTotalAmmo (source, 11) local weaponAmmo12 = getPedTotalAmmo (source, 12) local Skiin = getPedSkin (source) fadeCamera (source, false) setTimer (setElementModel, 3000, 1, source, Skiin, true) setTimer (spawnPlayer, 2000, 1, source, 2027.7943115234, 2167.0517578125, 13.61945438385, 0, getPedSkin (source), 0, 0, getPlayerTeam(source)) setTimer (setCameraTarget, 2250, 1, source, source) setTimer (fadeCamera, 3000, 1, source, true) setTimer (giveWeapon, 3000, 1, source, theWeapon, weaponAmmo, true) setTimer (giveWeapon, 3000, 1, source, theWeapon1, weaponAmmo1, true) setTimer (giveWeapon, 3000, 1, source, theWeapon2, weaponAmmo2, true) setTimer (giveWeapon, 3000, 1, source, theWeapon3, weaponAmmo3, true) setTimer (giveWeapon, 3000, 1, source, theWeapon4, weaponAmmo4, true) setTimer (giveWeapon, 3000, 1, source, theWeapon5, weaponAmmo5, true) setTimer (giveWeapon, 3000, 1, source, theWeapon6, weaponAmmo6, true) setTimer (giveWeapon, 3000, 1, source, theWeapon7, weaponAmmo7, true) setTimer (giveWeapon, 3000, 1, source, theWeapon8, weaponAmmo8, true) setTimer (giveWeapon, 3000, 1, source, theWeapon9, weaponAmmo9, true) setTimer (giveWeapon, 3000, 1, source, theWeapon10, weaponAmmo10, true) setTimer (giveWeapon, 3000, 1, source, theWeapon11, weaponAmmo11, true) setTimer (giveWeapon, 3000, 1, source, theWeapon12, weaponAmmo12, true) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted) Link to comment
#Dv^ Posted January 10, 2017 Share Posted January 10, 2017 Es algo más sencillo así :b local weapons = {} addEventHandler("onPlayerWasted", root, function(ammo, attacker, weapon) for i = 0, 12 do local weapon = getPedWeapon ( source, i ) local ammo = getPedTotalAmmo( source, i) weapons[weapon] = ammo end end ) addEventHandler ( "onPlayerSpawn", getRootElement(), function ( ) for weapon, ammo in pairs ( weapons ) do giveWeapon(source, weapon, ammo, true) end end ) 1 Link to comment
Sticmy Posted January 19, 2017 Author Share Posted January 19, 2017 On 10/1/2017 at 02:02, #Dv^ said: Es algo más sencillo así :b local weapons = {} addEventHandler("onPlayerWasted", root, function(ammo, attacker, weapon) for i = 0, 12 do local weapon = getPedWeapon ( source, i ) local ammo = getPedTotalAmmo( source, i) weapons[weapon] = ammo end end ) addEventHandler ( "onPlayerSpawn", getRootElement(), function ( ) for weapon, ammo in pairs ( weapons ) do giveWeapon(source, weapon, ammo, true) end end ) Revivo mi post, el problema sigue use tu código y se aumento el como 400 veces más. Link to comment
#Dv^ Posted January 19, 2017 Share Posted January 19, 2017 El código funciona bien, tú lo habrás involucrado con otro script quizás Link to comment
eloriginal Posted January 19, 2017 Share Posted January 19, 2017 13 hours ago, MarkFlash said: Revivo mi post, el problema sigue use tu código y se aumento el como 400 veces más. A lo mejor es el sistema de Compra de armas que usas bro. Link to comment
Sticmy Posted January 23, 2017 Author Share Posted January 23, 2017 No, me di armas también con el panel admin, y sucede lo mismo. Link to comment
eloriginal Posted January 24, 2017 Share Posted January 24, 2017 22 hours ago, MarkFlash said: No, me di armas también con el panel admin, y sucede lo mismo. revisa tu debugscript, inicia cada script uno a uno a ver si te da error alguno y los errores que te salgas arreglalos a ver si te sirve a lo mejor es un bug que tiene un script Link to comment
#Dv^ Posted January 24, 2017 Share Posted January 24, 2017 (edited) Con el mismo código que te dí, usá toJSON para guardar la tabla en la cuenta del jugador cuando desconecte y fromJSON para extraer la tabla guardada en la cuenta del jugador cuando loguee Edited January 24, 2017 by #Dv^ Link to comment
eloriginal Posted January 24, 2017 Share Posted January 24, 2017 Tambien usas SQLife Para cuando se le piedan las armas,dinero,zombiekiller etc. Pdt:Yo se que este no es el tema pero este seria un metodo para que cuando se le pierda algo ya sea dinero,armas,zombiekiller ect con el QSLife devuelvas esas dichas cosas Link to comment
Sticmy Posted January 25, 2017 Author Share Posted January 25, 2017 Mi script está todo en Mysql solo algunos, uso datas, y un poco de tablas pero el de armas no use mysql, me dio un poco de flojera pero intentaré de hacerlo gracias Link to comment
eloriginal Posted January 25, 2017 Share Posted January 25, 2017 41 minutes ago, MarkFlash said: Mi script está todo en Mysql solo algunos, uso datas, y un poco de tablas pero el de armas no use mysql, me dio un poco de flojera pero intentaré de hacerlo gracias De todos modos verifica tus scrpts para ver si alguno se esta relacionando con las armas Link to comment
Recommended Posts