• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Amount kill

Remove everything related to amount and item reward, then add the outfit id in the table and use it in the function.
Code:
local config = {
     ['demon'] = {storage = 19554, outfit = {20, 2}},
     ['dragon'] = {storage = 19001, outfit = {20, 3}}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end

     if getPlayerStorageValue(cid, monster.storage) ~= 1 then
         setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
     end
     if getPlayerStorageValue(cid, monster.storage) ~= 1 then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
         doPlayerAddItem(cid, monster.reward[1], monster.reward[2])
         end
         if math.random(1, 5) == 1 then
         doPlayerAddOutfitId(cid, outfitId, addon)
         setPlayerStorageValue(cid, monster.storage, 1)
     end
     return true
end
 
Remove this (The +1 storage was to count the monsters).
Code:
if getPlayerStorageValue(cid, monster.storage) ~= 1 then
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
end

An if statement has to close with end (under it), so add the end above "if math.random(1, 5) == 1 then" under setPlayerStorageValue.
Use the table to get the oufit id and addons.
Code:
doPlayerAddOutfitId(cid, monster.outfit[1], monster.outfit[2])

And remove this, sinc it's not used anymore.
Code:
doPlayerAddItem(cid, monster.reward[1], monster.reward[2])

And this
Code:
{storage = 19001, outfit = {20, 3}}}
It has a } to much, 1 is to close the one before storage, the other is to close the one before 20, so remove the last one.
 
Remove this (The +1 storage was to count the monsters).
Code:
if getPlayerStorageValue(cid, monster.storage) ~= 1 then
setPlayerStorageValue(cid, monster.storage, getPlayerStorageValue(cid, monster.storage) + 1)
end

An if statement has to close with end (under it), so add the end above "if math.random(1, 5) == 1 then" under setPlayerStorageValue.
Use the table to get the oufit id and addons.
Code:
doPlayerAddOutfitId(cid, monster.outfit[1], monster.outfit[2])

And remove this, sinc it's not used anymore.
Code:
doPlayerAddItem(cid, monster.reward[1], monster.reward[2])

And this
Code:
{storage = 19001, outfit = {20, 3}}}
It has a } to much, 1 is to close the one before storage, the other is to close the one before 20, so remove the last one.
Code:
local config = {
     ['demon'] = {storage = 19554, outfit = {20, 2}},
     ['dragon'] = {storage = 19447, outfit = {20, 3}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end
     if getPlayerStorageValue(cid, monster.storage) ~= 1 then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
         end
         if math.random(1, 5) == 1 then
         doPlayerAddOutfitId(cid, monster.outfit[1], monster.outfit[2])
         setPlayerStorageValue(cid, monster.storage, 1)
     end
     return true
end
and how i can edite chance?
 
Add the textmessage under the chance if statement, so players only get it when they get the addon.
You still have to move the end under setPlayerStorageValue.

The chance works line this.
math.random(1,5) gets a random number. 1, 2, 3, 4 or 5, all same chance, so this makes it 20% change, 1 out of 5 is the same as 20% (100:5=20).
 
Add the textmessage under the chance if statement, so players only get it when they get the addon.
You still have to move the end under setPlayerStorageValue.

The chance works line this.
math.random(1,5) gets a random number. 1, 2, 3, 4 or 5, all same chance, so this makes it 20% change, 1 out of 5 is the same as 20% (100:5=20).
Code:
local config = {
     ['demon'] = {storage = 19554, outfit = {20, 2}},
     ['Strong Freak'] = {storage = 19774, outfit = {19, 2}},
     ['dragon'] = {storage = 19447, outfit = {20, 3}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end
     if math.random(1, 5) == 1 then
         doPlayerAddOutfitId(cid, monster.outfit[1], monster.outfit[2])
         setPlayerStorageValue(cid, monster.storage, 1)
     if getPlayerStorageValue(cid, monster.storage) ~= 1 then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
         end
     end
     return true
end

to make chnace 100% make it (4,5) ??



edite

when kill one dragon get full outfit "20" :S
 
Last edited:
Add
Code:
if getPlayerStorageValue(cid, monster.storage) ~= 1 then
Above if math.random(1, 5) == 1 then.

If statements work line this.
Code:
if ... then
   -- this (what is added between if and end) will happen if ... is true, it won't happen if ... is not true
end
http://otland.net/threads/scripting-guide.74030/#post-758243

When adding addons, 0 means no addon, 1 is for the first addon, 2 is for the second addon and 3 is for both addons.
 
Add
Code:
if getPlayerStorageValue(cid, monster.storage) ~= 1 then
Above if math.random(1, 5) == 1 then.

If statements work line this.
Code:
if ... then
   -- this (what is added between if and end) will happen if ... is true, it won't happen if ... is not true
end
http://otland.net/threads/scripting-guide.74030/#post-758243

When adding addons, 0 means no addon, 1 is for the first addon, 2 is for the second addon and 3 is for both addons.
Code:
local config = {
     ['demon'] = {storage = 19554, outfit = {20, 2}},
     ['Strong Freak'] = {storage = 19774, outfit = {19, 1}},
     ['dragon'] = {storage = 19447, outfit = {20, 1}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end
     if getPlayerStorageValue(cid, monster.storage) ~= 1 then
     end
     if math.random(4, 5) == 1 then
         doPlayerAddOutfitId(cid, monster.outfit[1], monster.outfit[2])
         setPlayerStorageValue(cid, monster.storage, 1)
     if getPlayerStorageValue(cid, monster.storage) ~= 1 then
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
     end
     end
     return true
end

please ell me i want make chance 100%
 
Just remove the change if statement
Code:
if math.random(4, 5) == 1 then
And fix the ends and the storage if statement like I explained.
 
Just remove the change if statement
Code:
if math.random(4, 5) == 1 then
And fix the ends and the storage if statement like I explained.
Code:
local config = {
     ['demon'] = {storage = 19554, outfit = {20, 2}},
     ['Strong Freak'] = {storage = 19774, outfit = {19, 1}},
     ['dragon'] = {storage = 19447, outfit = {20, 1}}
}
function onKill(cid, target)
     local monster = config[getCreatureName(target):lower()]
     if isPlayer(target) or not monster or isSummon(target) then
         return true
     end
     if getPlayerStorageValue(cid, monster.storage) ~= 1 then
         doPlayerAddOutfitId(cid, monster.outfit[1], monster.outfit[2])
         setPlayerStorageValue(cid, monster.storage, 1)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a reward.')
     end
     return true
end

that im understand from u i hope im right but really u learned me alo :D
 
Congratulations, you have killed '..(getPlayerStorageValue(cid, monster.storage)+1)..' '..getCreatureName(target)..'s and received a first addon.')

but need say outfit name and if i get second addon say too
 
You can add in the table
Code:
message = 'the second addon of ... outfit'
Then in the message
Code:
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you have killed a '..getCreatureName(target)..' and received '..monster.message..'.')
 
19:25 Congratulations, you have killed a Strong Freak and received the second addon of ... Demonhunter.


['strong freak'] = {storage = 19774, outfit = {19, 2}, message = 'the second addon of Demonhunter'},
 
now i want to make items when use give u outfit for time u can explain for me how to use timer in it
Code:
local config = {
    cost = {6527, 4}
    }
function onUse(cid, item, fromPosition, itemEx, toPosition)
if not doPlayerRemoveItem(cid, config.cost[1], config.cost[2]) then
    doCreatureSay(cid, "You need "..config.cost[2].." " .. getItemInfo(config.cost[1]).plural .. " to change ur outfit ", TALKTYPE_ORANGE_1)
        doSendMagicEffect(getThingPos(cid), 2)
        return true
    end
local v, tmp = math.random(365), getCreatureOutfit(cid)
while isInArray({tmp.lookType, 302,146,155,151,156,152,157,153,158,154,252,251,269,268,270,273,279,278,288,289,324,325,336,335,366,367,136,137,129,128,138,130,139,131,140,132,141,133,142,134,147,143,148,144,149,145,150,75, 135, 266}, v) == TRUE or v <= 1 or (v > 160 and v < 192) or v > 333 do
v = math.random(365)
end

tmp.lookType = v
doCreatureChangeOutfit(cid, tmp)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doCreatureSay(cid, 'Your outfit has been changed.', TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
return TRUE
end

how to add timer here for 30 min and than back to his normal outfit
 
Back
Top