• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

explain this script

Kjhgfd

New Member
Joined
Dec 25, 2016
Messages
63
Reaction score
1
anyone can explain for me this script ??

Code:
local key = 125

function onKill(cid, target, damage, flags)
    if isMonster(target) and getPlayerLevel(cid) >= 400 and getCreatureMaxHealth(target) >= 500 and getCreatureMaster(target) == target and getCreatureStorage(cid, 126) == -1 then
        local n = math.max(0, getCreatureStorage(cid, key)) + 1
        doCreatureSetStorage(cid, key, n)
        if n >= 800 then
            local add, a, b, r = math.random(2) == 1
            if add then
                a, b = math.random(20), math.random(20)
            else
                a = math.random(5, 25)
                b = math.random(a-1)
            end
            doCreatureSay(cid, "Please answer this question within 10 minutes to avoid being banished: " .. a .. (add and "+" or "-") .. b .. " = ?\nExample 1+1: !answer 2", TALKTYPE_ORANGE_1, false, cid)
            doCreatureSetStorage(cid, 126, ',' .. a .. (add and "+" or "-") .. b)
            doCreatureSetStorage(cid, 127, add and a+b or a-b)
            doCreatureSetStorage(cid, 128, os.time() + 600)
        end
    end
    return true
end
 
...
Code:
Example 1+1: !answer 2
Giving you 2 random numers, which u must add/substrack and give the answer - result
 
If your character's level is bigger or equal to 400, it counts every monster you kill that is over 500 maximum HP and after reaching 800 kills it suppose to give you some simple operation to solve.
 
If your character's level is bigger or equal to 400, it counts every monster you kill that is over 500 maximum HP and after reaching 800 kills it suppose to give you some simple operation to solve.
not work like u said because i changed 800 to 15 .. and don't get any questions
 
Code:
doCreatureSetStorage(cid, 126, ',' .. a .. (add and "+" or "-") .. b)
            doCreatureSetStorage(cid, 127, add and a+b or a-b)
Since when you can use storages with strings?
 
local key = 125

function onKill(cid, target, damage, flags)
if isMonster(target) and getPlayerLevel(cid) >= 400 and getCreatureMaxHealth(target) >= 500 and getCreatureMaster(target) == target and getPlayerStorageValue(cid, 126) == -1 then
local n = math.max(0, getCreatureStorage(cid, key)) + 1
setPlayerStorageValue(cid, key, n)
if n >= 800 then
local add, a, b, r = math.random(2) == 1
if add then
a, b = math.random(20), math.random(20)
else
a = math.random(5, 25)
b = math.random(a-1)
end
doCreatureSay(cid, "Please answer this question within 10 minutes to avoid being banished: " .. a .. (add and "+" or "-") .. b .. " = ?\nExample 1+1: !answer 2", TALKTYPE_ORANGE_1, false, cid)
setPlayerStorageValue(cid, 126, ',' .. a .. (add and "+" or "-") .. b)
setPlayerStorageValue(cid, 127, add and a+b or a-b)
setPlayerStorageValue(cid, 128, os.time() + 600)
end
end
return true
end
 
local key = 125

function onKill(cid, target, damage, flags)
if isMonster(target) and getPlayerLevel(cid) >= 400 and getCreatureMaxHealth(target) >= 500 and getCreatureMaster(target) == target and getPlayerStorageValue(cid, 126) == -1 then
local n = math.max(0, getCreatureStorage(cid, key)) + 1
setPlayerStorageValue(cid, key, n)
if n >= 800 then
local add, a, b, r = math.random(2) == 1
if add then
a, b = math.random(20), math.random(20)
else
a = math.random(5, 25)
b = math.random(a-1)
end
doCreatureSay(cid, "Please answer this question within 10 minutes to avoid being banished: " .. a .. (add and "+" or "-") .. b .. " = ?\nExample 1+1: !answer 2", TALKTYPE_ORANGE_1, false, cid)
setPlayerStorageValue(cid, 126, ',' .. a .. (add and "+" or "-") .. b)
setPlayerStorageValue(cid, 127, add and a+b or a-b)
setPlayerStorageValue(cid, 128, os.time() + 600)
end
end
return true
end
same nothing happen :S
 
Code:
doCreatureSetStorage(cid, 126, ',' .. a .. (add and "+" or "-") .. b)
            doCreatureSetStorage(cid, 127, add and a+b or a-b)
Since when you can use storages with strings?
I think it's possible in older TFS versions.


not work like u said because i changed 800 to 15 .. and don't get any questions
You killed 500+ hp monsters with 400 lvl character? (they must be wild monsters/not summons)
Character must have storage value 126 set to -1 in order to count a kill.

same nothing happen :S
You should have some errors at least.
You sure you registered this correctly? Where did you get this script?
 
I think it's possible in older TFS versions.



You killed 500+ hp monsters with 400 lvl character? (they must be wild monsters/not summons)
Character must have storage value 126 set to -1 in order to count a kill.


You should have some errors at least.
You sure you registered this correctly? Where did you get this script?

yes im killing monster with hp 500+ {hero} with char lvl 400+ and im sure registered this correctly
i think i must add something in database
 
yes im killing monster with hp 500+ {hero} with char lvl 400+ and im sure registered this correctly
i think i must add something in database
Registered in both creaturescripts.xml and login.lua?
You can check in database, if character you're using has storage 126 set to -1.
 
Back
Top