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

Dobrze napisane?

Julek12

New Member
Joined
Feb 19, 2008
Messages
160
Reaction score
0
Location
Universe -> Milky Way -> Solar System -> Earth ->
Chciałbym się zapytać czy dobrze napisałem skrypt jeszcze nie testowałem.
Code:
local config =
    {
    ice = {x=134, y=199, z=5},
    fire = {x=68, y=151, z=5},
    energy = {x=72, y=197, z=5},
    earth = {x=140, y=158, z=5},
    message_type = MESSAGE_EVENT_ORANGE
    }

function onStepIn(cid, item, position, fromPosition)

    if getPlayerLookDir(cid) == 0 then
        newdir = 2
    elseif getPlayerLookDir(cid) == 1 then
        newdir = 3
    elseif getPlayerLookDir(cid) == 2 then
        newdir = 0
    else
        newdir = 1
    end

    if (item.actionid > 34000 and item.actionid < 34020) then
        if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
            doTeleportThing(cid,config.ice)
            doSendMagicEffect(config.ice,10)
            setPlayerStorageValue(cid, 36002, item.actionid - 34000)
        else
            doPlayerSendTextMessage(cid, config.message_type, "Only Premium Druids of level 30 or higher are able to enter this portal")
            doMoveCreature(cid, newdir)
        end
    elseif (item.actionid > 34100 and item.actionid < 34120) then
        if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
            doTeleportThing(cid,config.earth)
            doSendMagicEffect(config.earth,10)
            setPlayerStorageValue(cid, 36002, item.actionid - 34100)
        else
            doPlayerSendTextMessage(cid, config.message_type, "Only Premium Druids of level 30 or higher are able to enter this portal")
            doMoveCreature(cid, newdir)
        end
    elseif (item.actionid > 34200 and item.actionid < 34220) then
        if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
            doTeleportThing(cid,config.fire)
            doSendMagicEffect(config.fire,10)
            setPlayerStorageValue(cid, 36002, item.actionid - 34200)
        else
            doPlayerSendTextMessage(cid, config.message_type, "Only Premium Sorcers of level 30 or higher are able to enter this portal")
            doMoveCreature(cid, newdir)
        end
    elseif (item.actionid > 34300 and item.actionid < 34320) then
        if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
            doTeleportThing(cid,config.energy)
            doSendMagicEffect(config.energy,10)
            setPlayerStorageValue(cid, 36002, item.actionid - 34300)
        else
            doPlayerSendTextMessage(cid, config.message_type, "Only Premium Sorcers of level 30 or higher are able to enter this portal")
            doMoveCreature(cid, newdir)
        end
    end
    return TRUE
end
i drugi one ze sobą współpracują:)

Code:
function onStepIn(cid, item, position, fromPosition)
    local array =
    {
    [1] = {x=134, y=199, z=5},
    [2] = {x=134, y=199, z=5},
    [3] = {x=134, y=199, z=5},
    [4] = {x=134, y=199, z=5},
    [5] = {x=134, y=199, z=5},
    [6] = {x=134, y=199, z=5},
    [7] = {x=134, y=199, z=5},
    [8] = {x=134, y=199, z=5},
    [9] = {x=134, y=199, z=5},
    [10] = {x=134, y=199, z=5},
    [11] = {x=134, y=199, z=5},
    [12] = {x=134, y=199, z=5},
    [13] = {x=134, y=199, z=5},
    [14] = {x=134, y=199, z=5},
    [15] = {x=134, y=199, z=5},
    [16] = {x=134, y=199, z=5},
    [17] = {x=134, y=199, z=5},
    [18] = {x=134, y=199, z=5},
    [19] = {x=134, y=199, z=5},
    [20] = {x=134, y=199, z=5}
    }

    for i, k in pairs(array) do
        if getPlayerStorageValue(cid, 36002) == i then
            doTeleportThing(cid,k)
            doSendMagicEffect(k,10)
            setPlayerStorageValue(cid, 36002, -1)
        else
            doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
            doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)
            setPlayerStorageValue(cid, 36002, -1)
        end
    end
    return TRUE
end
 
Code:
local array =
    {
    [1] = {x=134, y=199, z=5},
    [2] = {x=134, y=199, z=5},
    [3] = {x=134, y=199, z=5},
    [4] = {x=134, y=199, z=5},
    [5] = {x=134, y=199, z=5},
    [6] = {x=134, y=199, z=5},
    [7] = {x=134, y=199, z=5},
    [8] = {x=134, y=199, z=5},
    [9] = {x=134, y=199, z=5},
    [10] = {x=134, y=199, z=5},
    [11] = {x=134, y=199, z=5},
    [12] = {x=134, y=199, z=5},
    [13] = {x=134, y=199, z=5},
    [14] = {x=134, y=199, z=5},
    [15] = {x=134, y=199, z=5},
    [16] = {x=134, y=199, z=5},
    [17] = {x=134, y=199, z=5},
    [18] = {x=134, y=199, z=5},
    [19] = {x=134, y=199, z=5},
    [20] = {x=134, y=199, z=5}
    }

po pierwsze co to k... jest xD? po co trzymasz 20 razy ta sama pozycje w tablicy ?
 
haha to nie indeksy to są wartości storage value jeżeli 1 to teleportuje gdzieś, jeśli 2 to gdzieś indziej itp
Code:
    for i, k in pairs(array) do
        if getPlayerStorageValue(cid, 36002) == i then
            doTeleportThing(cid,k)

        else
            doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
            doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)
            setPlayerStorageValue(cid, 36002, -1)
o to mi chodzi czy jest dobrze:p

To są teleporty do enchantów tak jak na realu. Jak wejdziesz w veno to z powrotem do venore cie teleportuje:)
 
Skoro lepiej wiesz to rób sam...
PHP:
local array =
    {
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5}
    }
 
Aha rozumiem cię:) i przepraszam faktycznie miałeś rację. Tylko teraz jak to napisać:p Zaraz dam i powiecie czy dobrze zrobiłem:)

Wygląda to teraz tak:
Code:
function onStepIn(cid, item, position, fromPosition)
    local array =
    {
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5},
    {x=134, y=199, z=5}
    }

    for i = 1, #array do
        if getPlayerStorageValue(cid, 36002) == i then
            doTeleportThing(cid,array[i])
            doSendMagicEffect(array[i],10)
            setPlayerStorageValue(cid, 36002, -1)
        else
            doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
            doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)),10)
            setPlayerStorageValue(cid, 36002, -1)
        end
    end
    return TRUE
end
 
Last edited:
Back
Top