CeKiT Posted September 9, 2012 Share Posted September 9, 2012 Hola a Todos. Quiero guardar los kills y deaths del gamemode stealth. Es muy dificil? Alguien que me oriente o me realize una base. Gracias Link to comment
Plate Posted September 10, 2012 Share Posted September 10, 2012 function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then deaths = getElementData(source,"Reset") setAccountData ( playeraccount, "Reset", deaths ) end end function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local deaths= getAccountData ( playeraccount, "Deaths" ) if ( deaths) then setElementData ( source, "Reset", deaths ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) prova haci Link to comment
BorderLine Posted September 10, 2012 Share Posted September 10, 2012 Reset? a que va ese codigo? te dare el codigo que yo uso addEventHandler ( "onPlayerWasted", root, function ( totalAmmo, killer, killerWeapon, bodypart, stealth ) if ( killer ) then local account = getPlayerAccount ( killer ) if ( killer ~= source ) then setAccountData ( account, "totalkillsdeaths.Kills", tonumber ( getAccountData ( account, "totalkillsdeaths.Kills" ) or 0 ) +1 ) setElementData ( killer, "Kills", tonumber ( getAccountData ( account, "totalkillsdeaths.Kills" ) ) ) end end local accountSource = getPlayerAccount ( source ) setAccountData ( accountSource, "totalkillsdeaths.Deaths", tonumber ( getAccountData ( accountSource, "totalkillsdeaths.Deaths" ) or 0 ) +1 ) setElementData ( source, "Deaths", tonumber ( getAccountData ( accountSource, "totalkillsdeaths.Deaths" ) ) ) end ) addEventHandler( "onPlayerLogin",root, function( thePreviousAccount, theCurrentAccount, autoLogin ) local account = getPlayerAccount ( source ) if not getAccountData( account,"totalkillsdeaths.Kills" ) and not getAccountData( account,"totalkillsdeaths.Deaths" ) then setAccountData( account,"totalkillsdeaths.Kills",0 ) setAccountData( account,"totalkillsdeaths.Deaths",0 ) end setElementData( source,"Deaths",tonumber( getAccountData( account,"totalkillsdeaths.Deaths" ) or 0 ) ) setElementData( source,"Kills",tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) ) end ) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() call(getResourceFromName("scoreboard"),"addScoreboardColumn","Kills", getRootElement(), 3, 35) call(getResourceFromName("scoreboard"),"addScoreboardColumn","Deaths", getRootElement(), 4, 35) end ) Link to comment
CeKiT Posted September 10, 2012 Author Share Posted September 10, 2012 este funciona yakuza? Lo probare cuando llege a mi house. Este codigo tambien le extablece en el scoreboard tambien la cantidad de kills y deaths? Si verdad? Link to comment
BorderLine Posted September 10, 2012 Share Posted September 10, 2012 exacto.. y si, ami me funciona. Link to comment
CeKiT Posted September 10, 2012 Author Share Posted September 10, 2012 debo editar algun archivo o solamente pongo un nuevo .lua y lo cargo con el meta del stealth. Por que pordefecto el scoreboard trae el kills y deahts. Link to comment
BorderLine Posted September 10, 2012 Share Posted September 10, 2012 una opcion seria que elimines esas columnas ke trae el stealth. porq deben ser distintos elementData en caso que quieras solo la linea para guardar. Te aconsejo que elimines las columnas del stealth. Busca entre los resources donde esta el call function y quitala. Debe estar en serverside Link to comment
CeKiT Posted September 10, 2012 Author Share Posted September 10, 2012 la verdad que te pasaste. Muchisimas gracias apenas este en mi pc lo hago. Link to comment
BorderLine Posted September 10, 2012 Share Posted September 10, 2012 de nada man cualquier cosa postea el codigo y te ayudamos los que podamos Link to comment
Plate Posted September 10, 2012 Share Posted September 10, 2012 jaja me olvide de cambiar eso en el script ese script uso yo para guardar los Resets en mi server Link to comment
Recommended Posts