Lurk
Active Member
- Joined
- Dec 4, 2017
- Messages
- 336
- Reaction score
- 49
Hello, I'm trying to apply a for to my script but it aint working, The same script is working perfectly without the for and it does work for the first value of the toKnow/storage, but not for the storage 123463 for example. I'm using tfs 0.4
The script aims to kick a player if he has a certain storage IF the time of other storage is over
the prints are showing me the currect values of the storages, the player should've been kiked
edit: when changing the prints to
I get this in the console:
I honestly have no idea what's happening here
edit: changed the prints to
and got this in the console
which is the expected, still when trying to
The script aims to kick a player if he has a certain storage IF the time of other storage is over
LUA:
local config = {
toKnow = 123456,
storage = 789456,
pos = {x = 160, y = 54, z = 7}, -- para onde o jogador será teleportado caso o tempo tenha acabado.
}
local count = 21
function onKill(cid, target, lastHit)
for i= 0, count-1 do
if getPlayerStorageValue(cid, config.toKnow+i) == 1 then
if getPlayerStorageValue(cid, config.storage+i) < os.time () then
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
doRemoveCreature(cid)
end
end
print("ToKnow OnKill: " ..config.toKnow+i.."")
print("Storage OnKill: "..config.storage+i.."")
end
return true
end
local count2 = 21
function onLogin(cid)
for i= 0, count2-1 do
if getPlayerStorageValue(cid, config.toKnow+i) == 1 then
if getPlayerStorageValue(cid, config.storage+i) < os.time () then
doTeleportThing(cid, config.pos)
setPlayerStorageValue(cid, config.toKnow+i, 0)
end
end
print("ToKnow OnLogin: " ..config.toKnow+i.."")
print("Storage OnLogin: "..config.storage+i.."")
end
return true
end
the prints are showing me the currect values of the storages, the player should've been kiked
edit: when changing the prints to
LUA:
print("ToKnow OnKill: " ..getPlayerStorageValue(cid, config.toKnow+i).."")
print("Storage OnKill: " ..getPlayerStorageValue(cid, config.storage+i).."")
print("I: " ..i.."")
I get this in the console:
Code:
ToKnow OnKill: 0
Storage OnKill: 1566452503
I: 0
ToKnow OnKill: 0
Storage OnKill: 1566958361
I: 1
ToKnow OnKill: -1
Storage OnKill: 1566781969
I: 2
ToKnow OnKill: -1
Storage OnKill: -1
I: 3
ToKnow OnKill: -1
Storage OnKill: -1
I: 4
ToKnow OnKill: -1
Storage OnKill: -1
I: 5
ToKnow OnKill: -1
Storage OnKill: -1
I: 6
ToKnow OnKill: -1
Storage OnKill: 1
I: 7
ToKnow OnKill: -1
Storage OnKill: -1
I: 8
ToKnow OnKill: -1
Storage OnKill: -1
I: 9
ToKnow OnKill: -1
Storage OnKill: -1
I: 10
ToKnow OnKill: -1
Storage OnKill: -1
I: 11
ToKnow OnKill: -1
Storage OnKill: -1
I: 12
ToKnow OnKill: -1
Storage OnKill: -1
I: 13
ToKnow OnKill: 0
Storage OnKill: 1565435340
I: 14
ToKnow OnKill: -1
Storage OnKill: -1
I: 15
ToKnow OnKill: 0
Storage OnKill: -1
I: 16
ToKnow OnKill: 0
Storage OnKill: -1
I: 17
ToKnow OnKill: 0
Storage OnKill: -1
I: 18
ToKnow OnKill: 0
Storage OnKill: -1
I: 19
ToKnow OnKill: -1
Storage OnKill: -1
I: 20
I honestly have no idea what's happening here
edit: changed the prints to
LUA:
print("config.toKnow + i: " ..config.toKnow+i.."")
print("config.storage + i: " ..config.storage+i.."\n")
and got this in the console
Code:
config.toKnow + i: 123456
config.storage + i: 789456
config.toKnow + i: 123457
config.storage + i: 789457
config.toKnow + i: 123458
config.storage + i: 789458
config.toKnow + i: 123459
config.storage + i: 789459
config.toKnow + i: 123460
config.storage + i: 789460
config.toKnow + i: 123461
config.storage + i: 789461
config.toKnow + i: 123462
config.storage + i: 789462
config.toKnow + i: 123463
config.storage + i: 789463
config.toKnow + i: 123464
config.storage + i: 789464
config.toKnow + i: 123465
config.storage + i: 789465
config.toKnow + i: 123466
config.storage + i: 789466
config.toKnow + i: 123467
config.storage + i: 789467
config.toKnow + i: 123468
config.storage + i: 789468
config.toKnow + i: 123469
config.storage + i: 789469
config.toKnow + i: 123470
config.storage + i: 789470
config.toKnow + i: 123471
config.storage + i: 789471
config.toKnow + i: 123472
config.storage + i: 789472
config.toKnow + i: 123473
config.storage + i: 789473
config.toKnow + i: 123474
config.storage + i: 789474
config.toKnow + i: 123475
config.storage + i: 789475
config.toKnow + i: 123476
config.storage + i: 789476
which is the expected, still when trying to
getPlayerStorageValue(cid, config.toKnow+i) == whatever I get those weird, giant numbers
Last edited: