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

Solved Use on map and add mark's

Szafi

www.rookwar.pl
Joined
Mar 2, 2009
Messages
165
Reaction score
10
Location
Poland
Hello, i use http://otland.net/threads/map-marks.36915/ how convert to "actions"?

Item ID: 1956 (Map)
Client: TFS 0.4, 8.60

How to convert script:

use item ID: 1956 ---> all marks add to minimap


Code:
local config = {
    storage = 9432,
    version = 1, -- Increase this value after adding new marks, so player can step again and receive new map marks
    marks = {
        {mark = 5, pos = {x = 1042, y = 1011, z = 6}, desc = "Temple"},
        {mark = 4, pos = {x = 1070, y = 1050, z = 7}, desc = "Premium tower"},
        {mark = 19, pos = {x = 1057, y = 1014, z = 6}, desc = ""},
        {mark = 19, pos = {x = 1041, y = 1026, z = 6}, desc = ""},
        {mark = 11, pos = {x = 1056, y = 1025, z = 7}, desc = "Depo"},
        {mark = 8, pos = {x = 1015, y = 1026, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1028, y = 1043, z = 7}, desc = "Rotwormy"},
        {mark = 8, pos = {x = 1042, y = 986, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1042, y = 986, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1079, y = 979, z = 7}, desc = "Expowisko"}
    }
}

local f_addMark = doPlayerAddMapMark
if(not f_addMark) then f_addMark = doAddMapMark end

function onStepIn(cid, item, position, fromPosition)
    if(isPlayer(cid) ~= TRUE or getPlayerStorageValue(cid, config.storage) == config.version) then
        return
    end

    for _, m  in pairs(config.marks) do
        f_addMark(cid, m.pos, m.mark, m.desc ~= nil and m.desc or "")
    end
    setPlayerStorageValue(cid, config.storage, config.version)
    return TRUE
end

Thanks for help, im newbie to lua and green
 
Change function onStepIn to function onUse
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

2 line:
[/code]storage = 9432,[/code]

what is it?

and how to remove item? I add
Code:
doRemoveItem(item.uid,1956)
and dont work

Code:
local config = {
    storage = 9432,
    version = 1, -- Increase this value after adding new marks, so player can step again and receive new map marks
    marks = {
        {mark = 5, pos = {x = 1042, y = 1011, z = 6}, desc = "Temple"},
        {mark = 4, pos = {x = 1070, y = 1050, z = 7}, desc = "Premium tower"},
        {mark = 19, pos = {x = 1057, y = 1014, z = 6}, desc = ""},
        {mark = 19, pos = {x = 1041, y = 1026, z = 6}, desc = ""},
        {mark = 11, pos = {x = 1056, y = 1025, z = 7}, desc = "Depo"},
        {mark = 8, pos = {x = 1015, y = 1026, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1028, y = 1043, z = 7}, desc = "Rotwormy"},
        {mark = 8, pos = {x = 1042, y = 986, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1042, y = 986, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1079, y = 979, z = 7}, desc = "Expowisko"},
        {mark = 3, pos = {x = 1036, y = 1026, z = 7}, desc = "Pomnik gracza"},
        {mark = 18, pos = {x = 1036, y = 1026, z = 7}, desc = "Statek"}
       
    }
}

local f_addMark = doPlayerAddMapMark
if(not f_addMark) then f_addMark = doAddMapMark end

function function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(isPlayer(cid) ~= TRUE or getPlayerStorageValue(cid, config.storage) == config.version) then
        return
    end

    for _, m  in pairs(config.marks) do
        f_addMark(cid, m.pos, m.mark, m.desc ~= nil and m.desc or "")
    end
    setPlayerStorageValue(cid, config.storage, config.version)
doRemoveItem(item.uid,1956)
    return TRUE
end
 
Thanks for help - all worked script on TFS 0.4 :

Item ID: 1956

Actions:
Code:
    <action itemid="1956" event="script" value="minimapa_klienta/marki.lua"/>

Lua:
Code:
local config = {
    storage = 9432,
    version = 1, -- Increase this value after adding new marks, so player can step again and receive new map marks
    marks = {
        {mark = 5, pos = {x = 1042, y = 1011, z = 6}, desc = "Temple"},
        {mark = 4, pos = {x = 1070, y = 1050, z = 7}, desc = "Premium tower"},
        {mark = 19, pos = {x = 1057, y = 1014, z = 6}, desc = ""},
        {mark = 19, pos = {x = 1041, y = 1026, z = 6}, desc = ""},
        {mark = 11, pos = {x = 1056, y = 1025, z = 7}, desc = "Depo"},
        {mark = 8, pos = {x = 1015, y = 1026, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1028, y = 1043, z = 7}, desc = "Rotwormy"},
        {mark = 8, pos = {x = 1042, y = 986, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1042, y = 986, z = 7}, desc = "Expowisko"},
        {mark = 8, pos = {x = 1079, y = 979, z = 7}, desc = "Expowisko"},
        {mark = 3, pos = {x = 1036, y = 1026, z = 7}, desc = "Pomnik gracza"},
        {mark = 18, pos = {x = 1026, y = 1004, z = 7}, desc = "Statek"}
    }
}

local f_addMark = doPlayerAddMapMark
if(not f_addMark) then f_addMark = doAddMapMark end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(isPlayer(cid) ~= TRUE or getPlayerStorageValue(cid, config.storage) == config.version) then
        return
    end

    for _, m  in pairs(config.marks) do
        f_addMark(cid, m.pos, m.mark, m.desc ~= nil and m.desc or "")
    end
    setPlayerStorageValue(cid, config.storage, config.version)
    doRemoveItem(item.uid)
    return TRUE
end

Bye :)
 
Back
Top