function loadOutfit(cid)
local result = db.getResult("SELECT `outfit` FROM `players` WHERE `id` = '"..getPlayerGUID(cid).."';")
if result:getID() == -1 then
return true
end
saved_outfit = split(result:getDataString("outfit"), '-')
result:free()
if(saved_outfit[1] == 0) then
saved_outfit[1] = 128
end
local outfit = {
lookType = saved_outfit[1],
lookHead = saved_outfit[2],
lookBody = saved_outfit[3],
lookLegs = saved_outfit[4],
lookFeet = saved_outfit[5],
lookAddons = saved_outfit[6]
}
return outfit
end
function saveOutfit(cid)
local outfit = getCreatureOutfit(cid)
local lookType = getCreatureOutfit(cid).lookType
local maleOutfits = {128, 129, 130, 131, 132, 133, 134, 143, 144, 145, 146, 151, 152, 153, 154, 251, 268, 273, 278, 289, 325, 328, 335, 367}
local femaleOutfits = {136, 137, 138, 139, 140, 141, 142, 147, 148, 149, 150, 155, 156, 157, 158, 252, 269, 270, 279, 288, 324, 329, 336, 366}
if lookType > 0 and lookType <= 596 then
db.query("UPDATE `players` SET `outfit` = '"..outfit.lookType.."-"..outfit.lookHead.."-"..outfit.lookBody.."-"..outfit.lookLegs.."-"..outfit.lookFeet.."-"..outfit.lookAddons.."' WHERE `id` = '"..getPlayerGUID(cid).."';")
elseif lookType == 0 then
db.queyr("UPDATE `players` SET `outfit` = '128-"..outfit.lookHead.."-"..outfit.lookBody.."-"..outfit.lookLegs.."-"..outfit.lookFeet.."-"..outfit.lookAddons.."' WHERE `id` = '"..getPlayerGUID(cid).."';")
else
doPlayerSendCancel(cid, "Sorry, you cannot save this outfit.")
end
end