Xagul
deathzot.net
- Joined
- Jun 30, 2008
- Messages
- 1,294
- Solutions
- 3
- Reaction score
- 1,037
Hello, here is a simple yet annoying talkaction requested by Sportacus. It allows players to save an outfit they are wearing to a slot for use later. Nice if you are the type of person that likes to use more than 1 outfit but are annoyed with changing them manually all the time I suppose. Anyway here is the code
Here is a screenshot of it doing its job.
This code is only slightly tested, lemme know if you find any problems with it and I will get them sorted.
Lua:
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
Here is a screenshot of it doing its job.
This code is only slightly tested, lemme know if you find any problems with it and I will get them sorted.