Ir para conteúdo

Salvar outfits


larissaots

Posts Recomendados

Créditos à Xagui. happy.png

 

Objetivo

Você pode salvar os seus outfits e depois com um simples comando, você pode carregar ele denovo. Serve como um slot, muito simples e útil.

 

Tutorial

talkactions.xml:

<talkaction words="!outfit" event="script" value="outfit.lua"/>

talkactions/scripts, crie arquivo com nome outfit.lua e bote isso dentro:

local foncig = {
outfitSlots = {
[1] = {storage = "outfitslot1", prem = false},
[2] = {storage = "outfitslot2", prem = false},
[3] = {storage = "outfitslot3", prem = true},
[4] = {storage = "outfitslot4", prem = true},
[5] = {storage = "outfitslot5", prem = true}
},
acceptedOutfits = {136, 128, 137, 129, 138, 130, 139, 131, 140, 132, 141, 133, 142, 134, 147, 143, 148, 144, 149, 145, 150, 146, 155, 151, 156, 152, 157, 153, 158, 154, 252, 251, 269, 268, 270, 273, 279, 278, 288, 289, 324, 325, 336, 335, 366, 367, 329, 328}
}

function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param. (example: !outfit 1 or !outfit 1, save)")
return true
end

local t = string.explode(param, ",")
t[1] = tonumber(t[1])

if(foncig.outfitSlots[t[1]]) then
if(not isPremium(cid) and foncig.outfitSlots[t[1]].prem == true) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This outfit slot is for premium only.")
end

if(t[2] and t[2] == "save") then
local currentOutfit = getCreatureOutfit(cid)
if(isInArray(foncig.acceptedOutfits, currentOutfit.lookType)) then
doCreatureSetStorage(cid, foncig.outfitSlots[t[1]].storage, "_".. currentOutfit.lookType ..",_".. currentOutfit.lookHead ..",_".. currentOutfit.lookBody ..",_".. currentOutfit.lookLegs ..",_".. currentOutfit.lookFeet ..",_".. currentOutfit.lookAddons)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your current outfit has been saved in slot ".. t[1] ..".")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your current outfit type is not allowed to be saved.")
end
return true
end

local o = tostring(getCreatureStorage(cid, foncig.outfitSlots[t[1]].storage)):gsub('_', ''):explode(',')
if(o[6]) then
doCreatureChangeOutfit(cid, {lookType = o[1], lookHead = o[2], lookBody = o[3], lookLegs = o[4], lookFeet = o[5], lookAddons = o[6]})
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your outfit has been changed to slot ".. t[1] ..".")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You do not have an outfit saved in slot ".. t[1] ..".")
end

else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid outfit slot.")
end
return true
end

Pronto.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...