• 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!

Lua Frags Appear After x time

cuba

New Member
Joined
Feb 24, 2015
Messages
136
Reaction score
2
hello otland i want script when player login if he have storage 2000
he need to wait x time everylogin to appear white skull

using tfs 0.4 dev
@owned
 
Last edited:
Code:
local function doPlayerSetSkullEnd(cid)
if getPlayerStorageValue(cid, 2000) == 1 then
doCreatureSetSkullType(cid,1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Msg")
end
return true
end
function onLogin(cid)
if isPlayer(cid) then
addEvent(doPlayerSetSkullEnd,5*1000, cid)
end
return true
end
 
Last edited:
Code:
local function doPlayerSetSkullEnd(cid)
if getPlayerStorageValue(cid, 2000) == 1 then
doCreatureSetSkullType(cid,1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Msg")
end
return true
end
function onLogin(cid)
if isPlayer(cid) then
addEvent(doPlayerSetSkullEnd,5*1000, cid)
end
return true
end
i want it in login then it will check player everylogin
 
@heba's script will work for you no problem you just have to make a new login script, or if you want post your login.lua and I'll add it there for you.
Thanks @owned @heba for your help
here is my login
Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
function onLogin(cid)
    doChangeSpeed(cid, 750)
    doCreatureSay(cid, "Welcome!", 19)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
    local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "Forever Amulet")
    registerCreatureEvent(cid, "onPrepareDeath")
    registerCreatureEvent(cid, "ZombieAttack")
    registerCreatureEvent(cid, "removeghostspell")
    registerCreatureEvent(cid, "removeghostcombat")
    registerCreatureEvent(cid, "AutoBuyer")
    registerCreatureEvent(cid, "SkullSystem")
    registerCreatureEvent(cid, "SkullLevel")
    registerCreatureEvent(cid, "BlockEffect")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")

   local storageItem = 11741
if (getPlayerStorageValue(cid, storageItem) > 0) and (getPlayerBlessing(cid, 1) == false) then
  doPlayerAddItem(cid, 2173, 1)
  doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 1)
for i = 1,5 do
  doPlayerAddBlessing(cid, i)
end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
    doCreatureSay(cid, "Automaticlly blessed and amulet of loss equiped!", 19)
  doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA)
end
    return true
end
 
@cuba
Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

local function setSkull(cid)
    if getPlayerStorageValue(cid, 2000) == 1 then
        doCreatureSetSkullType(cid,1)
    end
end

function onLogin(cid)
    addEvent(setSkull, 3000, cid)
    doChangeSpeed(cid, 750)
    doCreatureSay(cid, "Welcome!", 19)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
    local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "Forever Amulet")
    registerCreatureEvent(cid, "onPrepareDeath")
    registerCreatureEvent(cid, "ZombieAttack")
    registerCreatureEvent(cid, "removeghostspell")
    registerCreatureEvent(cid, "removeghostcombat")
    registerCreatureEvent(cid, "AutoBuyer")
    registerCreatureEvent(cid, "SkullSystem")
    registerCreatureEvent(cid, "SkullLevel")
    registerCreatureEvent(cid, "BlockEffect")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")

   local storageItem = 11741
if (getPlayerStorageValue(cid, storageItem) > 0) and (getPlayerBlessing(cid, 1) == false) then
  doPlayerAddItem(cid, 2173, 1)
  doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 1)
for i = 1,5 do
  doPlayerAddBlessing(cid, i)
end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
    doCreatureSay(cid, "Automaticlly blessed and amulet of loss equiped!", 19)
  doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA)
end
    return true
end

This will work for you. Test it on an actual player since it wont work on a gm.
 
@cuba
Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

local function setSkull(cid)
    if getPlayerStorageValue(cid, 2000) == 1 then
        doCreatureSetSkullType(cid,1)
    end
end

function onLogin(cid)
    addEvent(setSkull, 3000, cid)
    doChangeSpeed(cid, 750)
    doCreatureSay(cid, "Welcome!", 19)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
    local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "Forever Amulet")
    registerCreatureEvent(cid, "onPrepareDeath")
    registerCreatureEvent(cid, "ZombieAttack")
    registerCreatureEvent(cid, "removeghostspell")
    registerCreatureEvent(cid, "removeghostcombat")
    registerCreatureEvent(cid, "AutoBuyer")
    registerCreatureEvent(cid, "SkullSystem")
    registerCreatureEvent(cid, "SkullLevel")
    registerCreatureEvent(cid, "BlockEffect")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")

   local storageItem = 11741
if (getPlayerStorageValue(cid, storageItem) > 0) and (getPlayerBlessing(cid, 1) == false) then
  doPlayerAddItem(cid, 2173, 1)
  doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 1)
for i = 1,5 do
  doPlayerAddBlessing(cid, i)
end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
    doCreatureSay(cid, "Automaticlly blessed and amulet of loss equiped!", 19)
  doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA)
end
    return true
end

This will work for you. Test it on an actual player since it wont work on a gm.
Awawaw you are very helpful member thanks owned very much
last thing i want from you can you make this login if get storage 3000 do set skull green and if storage 4000 do set skull white and if get storage 5000 do set yellow and if get storage 6000 do set red and if get storage 7000 do set black
sorry for you time this last thing bro thanks
@owned
 
Awawaw you are very helpful member thanks owned very much
last thing i want from you can you make this login if get storage 3000 do set skull green and if storage 4000 do set skull white and if get storage 5000 do set yellow and if get storage 6000 do set red and if get storage 7000 do set black
sorry for you time this last thing bro thanks
@owned
Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

local function setSkull(cid)
    if getCreatureStorage(cid, 2000) >= 1 then
    local skull = getCreatureStorage(cid, 2000) then
        doCreatureSetSkullType(cid,skull)
    end
end

function onLogin(cid)
    addEvent(setSkull, 3000, cid)
    doChangeSpeed(cid, 750)
    doCreatureSay(cid, "Welcome!", 19)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
    local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "Forever Amulet")
    registerCreatureEvent(cid, "onPrepareDeath")
    registerCreatureEvent(cid, "ZombieAttack")
    registerCreatureEvent(cid, "removeghostspell")
    registerCreatureEvent(cid, "removeghostcombat")
    registerCreatureEvent(cid, "AutoBuyer")
    registerCreatureEvent(cid, "SkullSystem")
    registerCreatureEvent(cid, "SkullLevel")
    registerCreatureEvent(cid, "BlockEffect")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")

   local storageItem = 11741
if (getPlayerStorageValue(cid, storageItem) > 0) and (getPlayerBlessing(cid, 1) == false) then
  doPlayerAddItem(cid, 2173, 1)
  doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 1)
for i = 1,5 do
  doPlayerAddBlessing(cid, i)
end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
    doCreatureSay(cid, "Automaticlly blessed and amulet of loss equiped!", 19)
  doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA)
end
    return true
end

Use this instead of the 2000-7000 or whatever, just change the storage value of 2000 and based on that storage it'll change the skull.
 
Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

local function setSkull(cid)
    if getCreatureStorage(cid, 2000) >= 1 then
    local skull = getCreatureStorage(cid, 2000) then
        doCreatureSetSkullType(cid,skull)
    end
end

function onLogin(cid)
    addEvent(setSkull, 3000, cid)
    doChangeSpeed(cid, 750)
    doCreatureSay(cid, "Welcome!", 19)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
    local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end
    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "Forever Amulet")
    registerCreatureEvent(cid, "onPrepareDeath")
    registerCreatureEvent(cid, "ZombieAttack")
    registerCreatureEvent(cid, "removeghostspell")
    registerCreatureEvent(cid, "removeghostcombat")
    registerCreatureEvent(cid, "AutoBuyer")
    registerCreatureEvent(cid, "SkullSystem")
    registerCreatureEvent(cid, "SkullLevel")
    registerCreatureEvent(cid, "BlockEffect")
    registerCreatureEvent(cid, "GuildMotd")
    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")

   local storageItem = 11741
if (getPlayerStorageValue(cid, storageItem) > 0) and (getPlayerBlessing(cid, 1) == false) then
  doPlayerAddItem(cid, 2173, 1)
  doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 1)
for i = 1,5 do
  doPlayerAddBlessing(cid, i)
end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
    doCreatureSay(cid, "Automaticlly blessed and amulet of loss equiped!", 19)
  doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA)
end
    return true
end

Use this instead of the 2000-7000 or whatever, just change the storage value of 2000 and based on that storage it'll change the skull.
please can u make it because im new on this work..
 
please can u make it because im new on this work..
It's the same thing as you requested except the only thing that's different is you change storage value 2000, from 1-5. If you can't understand that then you need to do some reading.
 
bro listen to me few seconds only
1-i need that script in creature script that if player level 100 do set storage 1000 if get player level 200 do set storage 2000 if get player level 300 set storage 3000 if get player 400 set storage 400

2-in login.lua
you gave me script that if player have storage 2000 he will get frags after 5 second when login
i need add more storage in login
like if get player storage 1000 create white skull and if storage 2000 create yellow skull and if storage 3000 create green skull and if storage 400 create red skull and all of thoes frags will work like that script u gave me in login frag appear after x seconds but this time more frags not 1 because we add more storages

i hope you understood me and sorry for your time
 
bro listen to me few seconds only
1-i need that script in creature script that if player level 100 do set storage 1000 if get player level 200 do set storage 2000 if get player level 300 set storage 3000 if get player 400 set storage 400

2-in login.lua
you gave me script that if player have storage 2000 he will get frags after 5 second when login
i need add more storage in login
like if get player storage 1000 create white skull and if storage 2000 create yellow skull and if storage 3000 create green skull and if storage 400 create red skull and all of thoes frags will work like that script u gave me in login frag appear after x seconds but this time more frags not 1 because we add more storages

i hope you understood me and sorry for your time
Or you simply do, if getPlayerLevel(cid) >= 100 then doCreatureSetStorage(cid, 2000, 1) if getPlayerLevel(cid) >= 200 then doCreatureSetStorage(cid, 2000, 2) I'm well aware of what you're trying to accomplish. This is just a much cleaner way to do it, and a lot less code. Like I said, if you don't understand what's going on here, you need to go read a tutorial or something. I've given you everything you need.
 
creaturescript.xml
Code:
<event type="advance" name="levelStorage" event="script" value="levelstorage.lua"/>

creaturescript/scripts/levelstorage.lua
Code:
local config = {
   level100 = 100,
   storage100 = 1000,
   level200 = 200,
   storage200 = 2000,
   level300 = 300,
   storage300 = 3000
}

function onAdvance(cid, skill, oldlevel, newlevel)
  if skill ~= SKILL__LEVEL then
  return true
  end
   
   if newlevel >= config.level100 and getPlayerStorageValue(cid, config.storage100) ~= 1 then
     doCreatureSetStorage(cid, config.storage100, 1)
   end

   if newlevel >= config.level200 and getPlayerStorageValue(cid, config.storage200) ~= 1 then
     doCreatureSetStorage(cid, config.storage200, 1)
   end

   if newlevel >= config.level300 and getPlayerStorageValue(cid, config.storage300) ~= 1 then
     doCreatureSetStorage(cid, config.storage300, 1)
   end

   return true
end

login.lua
add:
Code:
registerCreatureEvent(cid, "levelStorage")

If I get you right :p

Not tested btw
 
creaturescript.xml
Code:
<event type="advance" name="levelStorage" event="script" value="levelstorage.lua"/>

creaturescript/scripts/levelstorage.lua
Code:
local config = {
   level100 = 100,
   storage100 = 1000,
   level200 = 200,
   storage200 = 2000,
   level300 = 300,
   storage300 = 3000
}

function onAdvance(cid, skill, oldlevel, newlevel)
  if skill ~= SKILL__LEVEL then
  return true
  end
 
   if newlevel >= config.level100 and getPlayerStorageValue(cid, config.storage100) ~= 1 then
     doCreatureSetStorage(cid, config.storage100, 1)
   end

   if newlevel >= config.level200 and getPlayerStorageValue(cid, config.storage200) ~= 1 then
     doCreatureSetStorage(cid, config.storage200, 1)
   end

   if newlevel >= config.level300 and getPlayerStorageValue(cid, config.storage300) ~= 1 then
     doCreatureSetStorage(cid, config.storage300, 1)
   end

   return true
end

login.lua
add:
Code:
registerCreatureEvent(cid, "levelStorage")

If I get you right :p

Not tested btw
Work's Perfect @Danger II

can u make the login.lua script that i write about?

i have this
Code:
local function setSkull(cid)
      if getPlayerStorageValue(cid, 2000) == 1 then
        doCreatureSetSkullType(cid,1)
    end
end

but i need to add all storages you gave me them on this login script
 

try this:
creaturescript/scripts/levelStorage.lua
Code:
local config = {
level100 = 100,
storage100 = 1000,
level200 = 200,
storage200 = 2000,
level300 = 300,
storage300 = 3000,
skullLevel100 = SKULL_YELLOW,
skullLevel200 = SKULL_WHITE,
skullLevel300 = SKULL_RED
}

function onAdvance(cid, skill, oldlevel, newlevel)
if skill ~= SKILL__LEVEL then
return true
end

if newlevel >= config.level100 and getPlayerStorageValue(cid, config.storage100) ~= 1 then
doCreatureSetStorage(cid, config.storage100, 1)
doCreatureSetSkullType(cid, config.skullLevel100)
end

if newlevel >= config.level200 and getPlayerStorageValue(cid, config.storage200) ~= 1 then
doCreatureSetStorage(cid, config.storage200, 1)
doCreatureSetSkullType(cid, config.skullLevel200)
end

if newlevel >= config.level300 and getPlayerStorageValue(cid, config.storage300) ~= 1 then
doCreatureSetStorage(cid, config.storage300, 1)
doCreatureSetSkullType(cid, config.skullLevel300)
end

return true
end

and in login.lua put this:
Code:
local config = {
   loginMessage = getConfigValue('loginMessage'),
   useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')),
   level100 = 100,
   storage100 = 1000,
   level200 = 200,
   storage200 = 2000,
   level300 = 300,
   storage300 = 3000,
   skullLevel100 = SKULL_YELLOW,
   skullLevel200 = SKULL_WHITE,
   skullLevel300 = SKULL_RED
}

function onLogin(cid)
  doChangeSpeed(cid, 750)
  doCreatureSay(cid, "Welcome!", 19)
  local loss = getConfigValue('deathLostPercent')
  if(loss ~= nil) then
  doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
  end

  local accountManager = getPlayerAccountManager(cid)
  if(accountManager == MANAGER_NONE) then
  local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
  if(lastLogin > 0) then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
  str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
  else
  str = str .. " Please choose your outfit."
  doPlayerSendOutfitWindow(cid)
  end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
  elseif(accountManager == MANAGER_NAMELOCK) then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
  elseif(accountManager == MANAGER_ACCOUNT) then
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
  else
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
  end
  if(not isPlayerGhost(cid)) then
  doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
  end

   if getPlayerStorageValue(cid, config.level100) > 0 then
     doCreatureSetSkullType(cid, config.skullLevel100)
   elseif getPlayerStorageValue(cid, config.level200) > 0 then
     doCreatureSetSkullType(cid, config.skullLevel200)
   elseif getPlayerStorageValue(cid, config.level300) > 0 then
     doCreatureSetSkullType(cid, config.skullLevel300)
   end

  registerCreatureEvent(cid, "Mail")
  registerCreatureEvent(cid, "Forever Amulet")
  registerCreatureEvent(cid, "onPrepareDeath")
  registerCreatureEvent(cid, "ZombieAttack")
  registerCreatureEvent(cid, "removeghostspell")
  registerCreatureEvent(cid, "removeghostcombat")
  registerCreatureEvent(cid, "AutoBuyer")
  registerCreatureEvent(cid, "SkullSystem")
  registerCreatureEvent(cid, "SkullLevel")
  registerCreatureEvent(cid, "BlockEffect")
  registerCreatureEvent(cid, "GuildMotd")
  registerCreatureEvent(cid, "Idle")
  if(config.useFragHandler) then
  registerCreatureEvent(cid, "SkullCheck")
  end
  registerCreatureEvent(cid, "ReportBug")
  registerCreatureEvent(cid, "AdvanceSave")

  local storageItem = 11741
if (getPlayerStorageValue(cid, storageItem) > 0) and (getPlayerBlessing(cid, 1) == false) then
  doPlayerAddItem(cid, 2173, 1)
  doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 1)
for i = 1,5 do
  doPlayerAddBlessing(cid, i)
end
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You received free AOL and BLESS.")
  doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
else
  doCreatureSay(cid, "Automaticlly blessed and amulet of loss equiped!", 19)
  doSendMagicEffect(getThingPos(cid), CONST_ME_HOLYAREA)
end
  return true
end

not sure if it works, havent tested it..
 
Last edited:
work's but why my login bugged when i added this
local function setSkull(cid)
to this
if getPlayerStorageValue(cid, 2000) == 1 then
doCreatureSetSkullType(cid,1)
elseif getPlayerStorageValue(cid, 3000) == 1 then
doCreatureSetSkullType(cid,2)
elseif getPlayerStorageValue(cid, 4000) == 1 then
doCreatureSetSkullType(cid,3)
end

to be like this
Code:
  local function setSkull(cid)
   if getPlayerStorageValue(cid, 2000) == 1 then
        doCreatureSetSkullType(cid,1)
   elseif getPlayerStorageValue(cid, 3000) == 1 then
      doCreatureSetSkullType(cid,2)
   elseif getPlayerStorageValue(cid, 4000) == 1 then
      doCreatureSetSkullType(cid,3)
   end
 
work's but why my login bugged when i added this
local function setSkull(cid)
to this
if getPlayerStorageValue(cid, 2000) == 1 then
doCreatureSetSkullType(cid,1)
elseif getPlayerStorageValue(cid, 3000) == 1 then
doCreatureSetSkullType(cid,2)
elseif getPlayerStorageValue(cid, 4000) == 1 then
doCreatureSetSkullType(cid,3)
end

to be like this
Code:
  local function setSkull(cid)
   if getPlayerStorageValue(cid, 2000) == 1 then
        doCreatureSetSkullType(cid,1)
   elseif getPlayerStorageValue(cid, 3000) == 1 then
      doCreatureSetSkullType(cid,2)
   elseif getPlayerStorageValue(cid, 4000) == 1 then
      doCreatureSetSkullType(cid,3)
   end

You put local function setSkull(cid) but did not end the function.
 
Back
Top