Search the Community
Showing results for tags 'funcion'.
-
hola yo hablo español ¿Cómo puedo crear una variable de contador que se guarde y cargue al cerrar el servidor? i no speak english How can I create a counter variable that is saved and loaded when shutting down the server? --------------------------------------------------------- "inst.components.helth.maxhealth" is = max hp character in theory "contador" It is my variable to create, when using it locally it is not saved, it is only restarted, not like the previous one that if it is modified because it is saved and loaded in the function -------------------------------------- local contador = contador or nil local function subirnivel(inst) if inst.components.health.maxhealth >= (1) and inst.components.health.maxhealth < (300) then inst.components.health.maxhealth = (inst.components.health.maxhealth + contador ) contador = contador * 0.9 end end ------------------------------------------- my funcion save and load local function onsave(inst, data) data.maxhealth = inst.components.health.maxhealth or nil end local function onpreload(inst, data) inst.components.health:SetMaxHealth(data.maxhealth) end ----------------------------------------------------------------------------- alguien tiene un ejemplo de como crear una variable para usarla como contador para poder guardar su valor y cargarlo sin que se reinicie en tiempo real o al cerrar y abrir el servidor o partida. someone has an example of how to create a variable to use as a counter to save its value and load it without rebooting in real time or when closing and opening the server or game.