Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- EGG System
- Author: MaXwEllDeN
- Version: 1.0
- ]]
- EGG_LIB = {
- func = {},
- Eggs = {
- [2147] = {Time = 1, imo = 2328, Pokes = {{na = "Pikachu", health = 1500}}}
- },
- enid = 1993,
- maxpokes = 1,
- }
- function getGenderPrefix(str)
- return (str:sub(#str, #str) == "a") and "a" or ""
- end
- function getItemsInContainer(container) -- Function By Kydrai
- local items = {}
- if isContainer(container) and getContainerSize(container) > 0 then
- for slot=0, (getContainerSize(container)-1) do
- local item = getContainerItem(container, slot)
- if isContainer(item.uid) then
- local itemsbag = getItemsInContainerById(item.uid)
- for i=0, #itemsbag do
- table.insert(items, itemsbag[i])
- end
- else
- table.insert(items, item)
- end
- end
- end
- return items
- end
- function printTableSI(aff) -- BETA ~ By MaXwEllDeN
- local s = "{"
- for a, b in pairs(aff) do
- local index = "[".. a .. "]"
- if (type(a) == "string") then
- index = '["'.. a ..'"]'
- end
- if (type(b) == "table") then
- value = printTableSI(b)
- elseif (type(b) == "string") then
- value = '"'.. b .. '"'
- else
- value = b
- end
- s = s .. index .. " = " .. value .. ", "
- end
- s = "{" .. s:sub(2, #s)
- return (#s < 3) and "{}" or (s:sub(1, #s-2) .. "}")
- end
- EGG_LIB.func.getEggs = function (player)
- if (getPlayerStorageValue(player, 72777) == -1) then
- setPlayerStorageValue(player, 72777, "{}")
- end
- local pass = loadstring("return ".. getPlayerStorageValue(player, 72777))()
- return pass
- end
- EGG_LIB.func.removeEgg = function (player, enc)
- local Eggs = EGG_LIB.func.getEggs(player)
- table.remove(Eggs, enc)
- return setPlayerStorageValue(player, 72777, printTableSI(Eggs))
- end
- EGG_LIB.func.addEgg = function (player, newegg)
- local Eggs = EGG_LIB.func.getEggs(player)
- table.insert(Eggs, newegg)
- return setPlayerStorageValue(player, 72777, printTableSI(Eggs))
- end
Advertisement
Add Comment
Please, Sign In to add comment