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

outfit w itemku

kilddqvist

New Member
Joined
Mar 13, 2022
Messages
12
Reaction score
0
Cześć,

zrobiłem sobie jakiś tam skrypcik na itemek który zmienia nam tylko wygląd (outfit)
czyli, po kliknieciu na item - zmienia nasz wyglad i teraz chciałbym zrobić tak, że jak juz klikniemy ten itemek, zmieni nam wygląd to jak naciśniemy na niego jeszcze raz wrócimy do formy pierwotnej z przed kliknieciem na ten itemek (cofa nam outfit ktory byl przed kliknieciem na itemek co nam zmieni wyglad)
proszę o pomoc.

action.xml
XML:
    <action itemid="2121" event="script" value="skin.lua"/>

skin.lua
Lua:
local config =
{
storage = 39695,
timee = 30, -- czas uzycia 30sekund ponownego itemka
efekt1 = 307, -- numer efektu
}
---------------------------------------------------------------------------------------------------------c17
function onUse(cid, interval)
if (getPlayerVocation(cid) == 66 or getPlayerVocation(cid) == 67 or getPlayerVocation(cid) == 68 or getPlayerVocation(cid) == 69 or getPlayerVocation(cid) == 70 or getPlayerVocation(cid) == 71 or getPlayerVocation(cid) == 162 or getPlayerVocation(cid) == 163 or getPlayerVocation(cid) == 164 or getPlayerVocation(cid) == 165 or getPlayerVocation(cid) == 234 or getPlayerVocation(cid) == 235 or getPlayerVocation(cid) == 236 or getPlayerVocation(cid) == 237 or getPlayerVocation(cid) == 348 or getPlayerVocation(cid) == 349 or getPlayerVocation(cid) == 350) -- numer vocation
    and exhaustion.get(cid, config.storage) == false then
        doSendMagicEffect(getPlayerPosition(cid),config.efekt1)
        exhaustion.set(cid,config.storage,config.timee)
local outfit = {lookType = 731}
doSetCreatureOutfit(cid, outfit, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, '~SKIN')
---------------------------------------------------------------------------------------------------------dendy
elseif (getPlayerVocation(cid) == 90 ) -- numer vocation
    and exhaustion.get(cid, config.storage) == false then
        doSendMagicEffect(getPlayerPosition(cid),config.efekt1)
        exhaustion.set(cid,config.storage,config.timee)
local outfit = {lookType = 671} -- numer looktype
doSetCreatureOutfit(cid, outfit, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, '~SKIN')
doPlayerSendCancel(cid, "You changed your outfit.")
end
return true
end
 
Use storage to local outfit if playergetvocation (cid) ==
 
Nie znam się za bardzo, ale może przed zmianą outfitu pobierz aktualną wartość (czyli akutalny jego outfit) i zapisz ją w storage, i gdy użyje ponownie zmień mu outfit na wartość tego storage a je wyzeruj
 
Dokładnie o tym samym napisałem , tylko że po angielsku.

Jeżeli outfit gracza jest równy storage = 1 to zmień na losowy i wyzeruj storage.
I później else storage == 0 daj graczowi outfit podstawowy.
 
Działa jak należy, klikasz i zapisuje aktualny outfit w storage i po ponownym kliknieciu przywraca Ci poprzedni outfit.
Lua:
local config =
{
    outfitStor =
    {
        lookType = 39696,
        lookHead = 39697,
        lookBody = 39698,
        lookLegs = 39699,
        lookFeet = 39700,
        lookAddons = 39701
    },
    storage = 39695,
    timee = 2, -- czas uzycia 30sekund ponownego itemka
    efekt1 = 307, -- numer efektu
    outfit1 = 731,
    outfit2 = 671
}

function onUse(cid, item, frompos, item2, itemEx, topos)
    if exhaustion.get(cid, config.storage) then
        doPlayerSendCancel(cid, "You are exhausted.")
        return false
    end
    if isInArray({66, 67, 68, 69, 70, 71, 162, 163, 164, 165, 234, 235, 236, 237, 348, 349, 350}, getPlayerVocation(cid)) then
        if getCreatureOutfit(cid).lookType ~= config.outfit1 then   
            for k, v in pairs(config.outfitStor) do
                setPlayerStorageValue(cid, v, getCreatureOutfit(cid)[k])
            end
            doCreatureChangeOutfit(cid, {lookType = config.outfit1})
            else
            doCreatureChangeOutfit(cid, {lookType = getPlayerStorageValue(cid, config.outfitStor.lookType),
                                        lookHead = getPlayerStorageValue(cid, config.outfitStor.lookHead),
                                        lookBody = getPlayerStorageValue(cid, config.outfitStor.lookBody),
                                        lookLegs = getPlayerStorageValue(cid, config.outfitStor.lookLegs),
                                        lookFeet = getPlayerStorageValue(cid, config.outfitStor.lookFeet),
                                        lookAddons = getPlayerStorageValue(cid, config.outfitStor.lookAddons)})
            for i=39696, 39701 do
                setPlayerStorageValue(cid, i, -1)
            end
        end
        
            
    elseif getPlayerVocation(cid) == 90 then
        if getCreatureOutfit(cid).lookType ~= config.outfit2 then   
            for k, v in pairs(config.outfitStor) do
                setPlayerStorageValue(cid, v, getCreatureOutfit(cid)[k])
            end
            doCreatureChangeOutfit(cid, {lookType = config.outfit2})
            else
            doCreatureChangeOutfit(cid, {lookType = getPlayerStorageValue(cid, config.outfitStor.lookType),
                                        lookHead = getPlayerStorageValue(cid, config.outfitStor.lookHead),
                                        lookBody = getPlayerStorageValue(cid, config.outfitStor.lookBody),
                                        lookLegs = getPlayerStorageValue(cid, config.outfitStor.lookLegs),
                                        lookFeet = getPlayerStorageValue(cid, config.outfitStor.lookFeet),
                                        lookAddons = getPlayerStorageValue(cid, config.outfitStor.lookAddons)})
            for i=39696, 39701 do
                setPlayerStorageValue(cid, i, -1)
            end
        end
    end
    doSendMagicEffect(getPlayerPosition(cid), config.efekt1)
    exhaustion.set(cid, config.storage, config.timee)
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, '~SKIN')
return true
end
 
Back
Top