Guest
Public paste!

Untitled

By: a guest | Mar 18th, 2010 | Syntax: None | Size: 0.88 KB | Hits: 69 | Expires: Never
Copy text to clipboard
  1. data/creaturescripts/scripts/login.lua
  2.  
  3. registerCreatureEvent(cid, "Reward")
  4. data/creaturescripts/creaturescripts.xml
  5.  
  6. <event type="advance" name="Reward" event="script" value="reward.lua"/>  
  7.  
  8. data/creaturescripts/scripts/reward.lua
  9.  
  10. function onAdvance(cid, skill, oldLevel, newLevel)
  11.         local cfg = {
  12.                 [1000] = { -- Storage
  13.                         50, -- Level
  14.                         2160, -- ID
  15.                         5 -- Count
  16.                 },
  17.                 [1001] = { -- Storage
  18.                         100, -- Level
  19.                         2160, -- ID
  20.                         10 -- Count
  21.                 }
  22.         }
  23.         if(skill == SKILL__LEVEL) then
  24.                 for s, x in pairs(cfg) do
  25.                         if(newLevel >= x[1]) then
  26.                                 if(getPlayerStorageValue(cid, s) < 1) then
  27.                                         doPlayerAddItem(cid, x[2], x[3])
  28.                                         setPlayerStorageValue(cid, s, 1)
  29.                                         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "CONGRATULATIONS, You've reached level " .. x[1] .. "! Here is your reward.")
  30.                                         break
  31.                                 end
  32.                         end
  33.                 end
  34.         end
  35.         return true
  36. end