VictorOtInfinit
Member
- Joined
- Mar 14, 2020
- Messages
- 139
- Solutions
- 3
- Reaction score
- 11
Hello guys, i have a problem with an addEvent. I need to reset a especific position inside of a array that is declarated in global.lua.
I have this array jogadorCasa = {} that have 40 slots, all 0's, when a player do a especific thing one especific storage is setted in a free space in the array.
Exemple:
Player did a thing.
jogadorCasa[1 (couse slot 1 is 0, so its a free slot)] = especific storage.
another player did the same thing
jogadorCasa[2] = especific storage
etc etc.
My problem is: How can i reset a especific position in the array after some time?
I tried to use addEvent like this:
He does what i want, but if the player gets off then the server crashes. I'm not passing any userdata to the addEvent so why is crashing? And how should i do to reset the array without addEvent? Sorry for the bad english.
I have this array jogadorCasa = {} that have 40 slots, all 0's, when a player do a especific thing one especific storage is setted in a free space in the array.
Exemple:
Player did a thing.
jogadorCasa[1 (couse slot 1 is 0, so its a free slot)] = especific storage.
another player did the same thing
jogadorCasa[2] = especific storage
etc etc.
My problem is: How can i reset a especific position in the array after some time?
I tried to use addEvent like this:
Lua:
local flag = especificSpaceThatMustBeReseted
local tempo = (getPlayerStorageValue(cid,storageGlobal+flag)-os.time())*1000
addEvent(function (flag)
jogadorCasa[flag] = 0
end,tempo,flag)
He does what i want, but if the player gets off then the server crashes. I'm not passing any userdata to the addEvent so why is crashing? And how should i do to reset the array without addEvent? Sorry for the bad english.