I have a problem, I downloaded an ot server 8.6 with the dream chalenger quest, but I would like to know how do I get the player to have only one of 2 outfits. for example the player when making one outfit will not have the other. The scripts came ready but I don't know where I can find the answer to that.
otx2 version 8.6
otx2 version 8.6
Lua:
local config =
{ storages = {bb = 15001, nk = 15002},
documents = {7844, 7845, 7846}, -- follower, officer, leader
rank = {15003, 15004},
sstorages = {{15009, 15010}, 15011, 15012},
outfits = {17,19}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid,config.storages.bb) < 1 and getPlayerStorageValue(cid,config.storages.nk) < 1) then
doPlayerSendCancel(cid, "You are not allowed to use this thing.")
return true;
end
if(not isInArray(config.documents, item.itemid)) then
return true;
end
local a = getPlayerStorageValue(cid,config.storages.bb) == 1 and 1 or 2;
local t=0;
for i=1,#config.documents do
if config.documents[i] == item.itemid then
t = i;
break;
end
end
if(getPlayerStorageValue(cid,config.rank[a]) < t) then
doPlayerSendCancel(cid, "You are not allowed to use this thing.")
return true;
end
if(t==1) then--noobish way to do it
if(getPlayerStorageValue(cid, config.sstorages[t][a]) == 1) then
doPlayerSendCancel(cid, "You have already used this item.")
return true;
end
else
if(getPlayerStorageValue(cid, config.sstorages[t]) == 1) then
doPlayerSendCancel(cid, "You have already used this item.")
return true;
end
end
doPlayerAddOutfitId(cid, config.outfits[a],t-1)
if(t==1) then
setPlayerStorageValue(cid,config.sstorages[t][a],1);
else
setPlayerStorageValue(cid,config.sstorages[t],1);
end
doRemoveItem(item.uid)
return true
end
Lua:
<outfit id="19" premium="yes">
<list gender="0" lookType="279" name="Brotherhood"/>
<list gender="1" lookType="278" name="Brotherhood"/>
</outfit>
<outfit id="17" premium="yes">
<list gender="0" lookType="269" name="Nightmare"/>
<list gender="1" lookType="268" name="Nightmare"/>
</outfit>
local config = {
small_diamond_id = 2145,
documents = {7844, 7845, 7846}, -- follower, officer, leader
}
local levers = {
[15051] = {pos = {x=32784,y=32229,z=14}, item = config.documents[1]},
[15052] = {pos = {x=32782,y=32225,z=14}, item = config.documents[2]},
[15053] = {pos = {x=32785,y=32223,z=14}, item = config.documents[3]},
[15061] = {pos = {x=32836,y=32228,z=14}, item = config.documents[1]},
[15062] = {pos = {x=32834,y=32224,z=14}, item = config.documents[2]},
[15063] = {pos = {x=32837,y=32222,z=14}, item = config.documents[3]}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1945) then
local diam = getTileItemById(levers[item.actionid].pos,config.small_diamond_id);
if(diam.itemid < 10) then
doPlayerSendCancel(cid, "You have to place a diamonc in order to use it.");
return true;
end
doRemoveItem(diam.uid,1);
doCreateItem(levers[item.actionid].item,1,levers[item.actionid].pos);
end
doTransformItem(item.uid,item.itemid==1945 and 1946 or 1945);
return true;
end