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

SQL , reset player_items as all "player samples".

ohman

Member
Joined
Oct 24, 2008
Messages
294
Reaction score
8
Location
Sweden
HI! I want to reset all players on my server. I want them to have the same eq they had when they first logged in to the server. How to do this?

I did this to reset all simple stuff:
UPDATE `players` SET `level` = 8, `experience` = 4200, `health` = 185
, `healthmax` = 185, `mana` = 40, `manamax` = 40, `manaspent` = 0, `cap` = 600
, `posx` = 32369, `posy` = 32241, `posz` = 7, `maglevel` = 0, `lastlogin` = 0
, `lastip` = 0, `skull` = 4, `stamina` = 4, `loss_experience` = 100, `loss_mana` = 100
, `loss_skills` = 100, `loss_containers` = 100, `loss_items` = 100, `promotion` = 0
, `marriage` = 0, `onlinetime1` = 0, `onlinetime2` = 0, `onlinetime3` = 0, `onlinetime4` = 0
, `onlinetime5` = 0, `onlinetime6` = 0, `onlinetime7` = 0, `onlinetimeall` = 0
, `onlinetimetoday` = 0, `balance` = 0, `pvp_blessing` = 0, `blessings` = 0
, `lastlogout` = 0, `rank_id` = 0, `skulltime` = 0, `soul` = 0, `lookaddons` = 0
, `looktype` = 136, `looklegs` = 58, `lookhead` = 78, `lookfeet` = 76, `lookbody` = 68, `town_id` = 1;
UPDATE `player_skills` SET `value` = 10, `count` = 0;

Is there any way to add x items to all player with x vocation? I know how to delete all items but that is not a good idea ;/ Thanks!
 
Reset the storages and put one firstitens to each vocation receive one item.
 
Reset the storages and put one firstitens to each vocation receive one item.

Hmm, what do you mean? Please explain better. Now I just got vocation sample. I can edit them by logging in and change the items. No problem, and then all new players will get these items, but all the players that allready got a character will have zero items. How to make them all get as the vocation sample? Thanks

This is a example of items for a Knight:

Code:
INSERT INTO `player_items` (`player_id`, `pid`, `sid`, `itemtype`, `count`, `attributes`) VALUES
(6, 1, 101, 2457, 1, ''),
(6, 3, 102, 1988, 1, ''),
(6, 4, 103, 2463, 1, ''),
(6, 5, 104, 2509, 1, ''),
(6, 7, 105, 2647, 1, ''),
(6, 8, 106, 2643, 1, ''),
(6, 102, 107, 2439, 1, ''),
(6, 102, 108, 8602, 1, ''),
(6, 102, 109, 8601, 1, ''),
(6, 102, 110, 7618, 30, 0x0f1e),
(6, 102, 111, 2152, 20, 0x0f14),
(6, 102, 112, 2789, 20, 0x0f14),
(6, 102, 113, 2120, 1, ''),
(6, 102, 114, 2554, 1, '');

But I cant do like this to all knights, I have around 500 players ^^
 
Can you explain better?

Yes!

I have around 500 character created on my server. I have made a reset now, all characters level 8.
At first they had the same eq as before the reset. But then I deleted "player_items".
Now all characters have 0 items. But I want them all to get for example a backpack, a rope, eq and more.

I can add eq to a player with this SQL command:

Code:
INSERT INTO `player_items` (`player_id`, `pid`, `sid`, `itemtype`, `count`, `attributes`) VALUES
(6, 1, 101, 2457, 1, ''),
(6, 3, 102, 1988, 1, ''),
(6, 4, 103, 2463, 1, ''),
(6, 5, 104, 2509, 1, ''),
(6, 7, 105, 2647, 1, ''),
(6, 8, 106, 2643, 1, ''),
(6, 102, 107, 2439, 1, ''),
(6, 102, 108, 8602, 1, ''),
(6, 102, 109, 8601, 1, ''),
(6, 102, 110, 7618, 30, 0x0f1e),
(6, 102, 111, 2152, 20, 0x0f14),
(6, 102, 112, 2789, 20, 0x0f14),
(6, 102, 113, 2120, 1, ''),
(6, 102, 114, 2554, 1, '');

But this only give eq to the player with id 6. I want to do so the command ^ gives all knights this items. I have one for each vocation. How to make the command not just give items to player with x id?

I hope you'll understand! Thanks
 
i think no impossible but u have one way more easy understand? if want i can post script, what is your tfs?
 
i think no impossible but u have one way more easy understand? if want i can post script, what is your tfs?

I think its more work chaning a first item script than find someone that know how to do this :p haha. But send me the script, can I choose in what order the items in the backpack should be?

EDIT: rev 0.3.7 5969
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
    <config name="firstitems_config"><![CDATA[
        config = {
            storage = 30001,
            items = {2050, 2382}
        }
    ]]></config>
    <event type="login" name="FirstItems" event="script"> <![CDATA[
        domodlib('firstitems_config')

        function onLogin(cid)
    local config = {
        voc_items = {
            { -- SORC
                {2190}, -- wand of vortex
                {2525}, -- dwarven shield
                {2647}, -- plate legs
                {2457}, -- steel helmet
                {2463} -- plate armor
            },
            { -- DRUID
                {2182}, -- snakebite rod
                {2525}, -- dwarven shield
                {2647}, -- plate legs
                {2457}, -- steel helmet
                {2463} -- plate armor
            },
            { -- PALADIN
                {2389}, -- spear
                {2525}, -- dwarven shield
                {2647}, -- plate legs
                {2457}, -- steel helmet
                {2463} -- plate armor
            },
            { -- KNIGHT
                {2383}, -- spike sword
                {2525}, -- dwarven shield
                {2647}, -- plate legs
                {2457}, -- steel helmet
                {2463} -- plate armor
            }
        },
        all_items = {
            {2429}, -- barbarian axe
        },
        extra_items = {
            {2789, 15},
            {2120},
            {5710}
        },
        knight_weapons = {
            {2423}, -- clerical mace
            {2429} -- barbarian axe
        }
    }
    if getPlayerGroupId(cid) < 3 then
        if getPlayerStorageValue(cid, storage) == -1 then
            local common = config.voc_items[getPlayerVocation(cid)]
            if common ~= nil then
                for _, v in ipairs(common) do
                    doPlayerAddItem(cid, v[1], v[2] or 1)
                end
            end

            local all = config.all_items
            if all ~= nil then
                for _, v in ipairs(all) do
                    doPlayerAddItem(cid, v[1], v[2] or 1)
                end
            end

            local extra = config.extra_items
            local bp = doPlayerAddItem(cid, 1988, 1)
            if extra ~= nil then
                for _, v in ipairs(extra) do
                    doAddContainerItem(bp, v[1], v[2] or 1)
                end
            end

            local weapons = config.knight_weapons
            if weapons ~= nil then
                for _, w in ipairs(weapons) do
                    if isKnight(cid) then
                        doAddContainerItem(bp, w[1], w[2] or 1)
                    end
                end
            end

            setPlayerStorageValue(cid, storage, 1)
        end
    end
    return true
end
    ]]></event>
</mod>
 
Reset players with:
Code:
UPDATE players SET level = 8, health = 185, healthmax = 185, experience = 4200, lookaddons = 0, mana = 35, manamax = 35, manaspent = 0, soul = 0, town_id = 5, posx = 32369, posy = 32241, posz = 7, cap = 470, sex = 0, lastlogin = 0, lastip = 0, skull = 0, skulltime = 0, rank_id = 0, guildnick = '', lastlogout = 0, blessings = 0, balance = 0, stamina = 151200000, loss_experience = 100, loss_mana = 100, loss_skills = 100, loss_containers = 100, loss_items = 100, premend = 0, online = 0, marriage = 0, promotion = 0, deleted = 0, created = 0, hide_char = 0, comment = '';

use first items why all login and have items added in script.
Enter creaturescripts.xml and added:
Code:
    <event type="logout" name="firstitems" event="script" value="demonOakLogout.lua"/>
now in login.lua (data/creaturescripts/scripts)
Code:
registerCreatureEvent(cid, "Firstitems")

and use script Techrlz or this:

I put name and ids. so u only need change IDS or use same items

Code:
local firstItems_storage = 30001

local commonItems = {
    {itemid=2554, inContainer = TRUE}, -- shovel
    {itemid=2120, inContainer = TRUE}, -- rope
    {itemid=2152, count=20, inContainer = TRUE}, -- 2 crystal coins
    {itemid=2789, count=20, inContainer = TRUE}, -- brown mushrom
    {itemid=2643} -- leather boots
}
local firstItems = {
    { -- Sorcerer
        {itemid=1988, container = TRUE}, -- backpack
        {itemid=2175}, -- spellbook
        {itemid=2190}, -- wand of vortex
        {itemid=8819}, -- magician's robe
        {itemid=8820}, -- mage hat
        {itemid=2468} -- studded legs
    },
    { -- Druid
        {itemid=1988, container = TRUE}, -- backpack
        {itemid=2175}, -- spellbook
        {itemid=2182}, -- snakebite rod
        {itemid=8819}, -- magician's robe
        {itemid=8820}, -- mage hat
        {itemid=2468} -- studded legs
    },
    { -- Paladin
        {itemid=1988, container = TRUE}, -- backpack
        {itemid=2456}, -- bow
        {itemid=2544, count = 100}, -- 100 arrows
        {itemid=2660}, -- ranger's cloak
        {itemid=2480}, -- legion helmet
        {itemid=8923} -- ranger legs
    },
    { -- Knight
        {itemid=1988, container = TRUE}, -- backpack
        {itemid=2439, inContainer = TRUE}, -- daramanian mace
        {itemid=8601, inContainer = TRUE}, -- steel axe
        {itemid=2509}, -- steel shield
        {itemid=8602}, -- jagged sword
        {itemid=2465}, -- brass armor
        {itemid=2481}, -- soldier helmet
        {itemid=2478} -- brass legs
    }
}

for _, items in ipairs(firstItems) do
    for _, item in ipairs(commonItems) do
        table.insert(items, item)
    end
end

function onLogin(cid)
    if getPlayerGroupId(cid) < 2 and getPlayerStorageValue(cid, firstItems_storage) <= 0 then
        local currvoc = getPlayerVocation(cid)
        local vocation = 5 > currvoc and currvoc or currvoc - 4
        local giveItems = firstItems[vocation]
    if giveItems then
        for _, v in ipairs(giveItems) do
    if v.container == TRUE then
        backpack = doPlayerAddItem(cid, v.itemid, 1)
    elseif v.inContainer == TRUE then
        doAddContainerItem(backpack, v.itemid, v.count or 1)
    else
        doPlayerAddItem(cid, v.itemid, v.count or 1)
        end
    end
end
setPlayerStorageValue(cid, firstItems_storage, 1)
end
return TRUE
end
 
Back
Top