iFoReX Posted September 2, 2012 Share Posted September 2, 2012 Porque el $ no se guarda ? function playerLeave() local playeracc = getPlayerAccount(source) if ( playeraccount == true ) then local playercash = getPlayerMoney(source) setAccountData(playeracc, "cash", playercash) end end function playerReJoin() local playeracc = getPlayerAccount(source) if (playeracc == true) then local playerbank = getAccountData(playeracc, "cash") if (playerbank == true) then setPlayerMoney(source, playerbank) end end end addEventHandler("onPlayerJoin", getRootElement(), playerReJoin) addEventHandler("onPlayerLeave", getRootElement(), playerLeave) Link to comment
Alexs Posted September 2, 2012 Share Posted September 2, 2012 (edited) function playerLeave() local playeracc = getPlayerAccount(source) if (playeracc) then local playercash = getPlayerMoney(source) setAccountData(playeracc, "cash", playercash) end end function playerReJoin() local playeracc = getPlayerAccount(source) if (playeracc) then local playerbank = getAccountData(playeracc, "cash") if (playerbank) then setPlayerMoney(source, playerbank) end end end addEventHandler("onPlayerJoin", getRootElement(), playerReJoin) addEventHandler("onPlayerQuit", getRootElement(), playerLeave) Revisa 'onPlayerLeave' y veras su bajo nivel de existencia. Tambien usabas 'playeraccount' cuando tu variable es 'playeracc' Edited September 2, 2012 by Guest Link to comment
Castillo Posted September 2, 2012 Share Posted September 2, 2012 1: Estas verificando si 'playeracc' es igual a 'true', pero no va a ser igual, porque va a devolver una cuenta. 2: Estas verificando si 'playerbank' es igual a 'true', pero si tiene algo guardado, va a ser un numero. Link to comment
Alexs Posted September 2, 2012 Share Posted September 2, 2012 1: Estas verificando si 'playeracc' es igual a 'true', pero no va a ser igual, porque va a devolver una cuenta.2: Estas verificando si 'playerbank' es igual a 'true', pero si tiene algo guardado, va a ser un numero. Solo por duda, verificarlo asi: if (playeracc) then Debería servir, verdad? Link to comment
Castillo Posted September 2, 2012 Share Posted September 2, 2012 Si, asi deberia verificar. Link to comment
iFoReX Posted September 2, 2012 Author Share Posted September 2, 2012 Entonces como uquedaria el script ? Link to comment
Alexs Posted September 2, 2012 Share Posted September 2, 2012 Entonces como uquedaria el script ? Como te lo Postee al principio: function playerLeave() local playeracc = getPlayerAccount(source) if (playeracc) then local playercash = getPlayerMoney(source) setAccountData(playeracc, "cash", playercash) end end function playerReJoin() local playeracc = getPlayerAccount(source) if (playeracc) then local playerbank = getAccountData(playeracc, "cash") if (playerbank) then setPlayerMoney(source, playerbank) end end end addEventHandler("onPlayerJoin", getRootElement(), playerReJoin) addEventHandler("onPlayerQuit", getRootElement(), playerLeave) Link to comment
Recommended Posts