xxgoosexx
GoosioOT
- Joined
- Jul 10, 2007
- Messages
- 298
- Reaction score
- 2
Code:
local egem = {7759,7760,7761,7762}
local gems = {2146,2147,2149,2150}
function onSay(cid, words, param)
if string.find(param," ",string.find(param,"[ice,fire,earth,energy]")+1) ~= nil then
etype = string.sub(param,0,string.find(param," ")-1)
amount = tonumber(string.sub(param,string.find(param," ")+1,string.len(param)))
else
etype = param
amount = 1
end
mana = amount * 200
soul = amount * 3
if etype == "ice" then
gtype = 1
elseif etype == "fire" then
gtype = 2
elseif etype == "earth" then
gtype = 3
elseif etype == "energy" then
gtype = 4
else
doPlayerSendCancel(cid,"Please type a correct elemental type (ice/fire/earth/energy)")
end
if getPlayerMana(cid) > mana then
if getPlayerSoul(cid) > soul then
if gtype >= 1 then
if doPlayerRemoveItem(cid,gems[gtype],amount) == TRUE then
doPlayerAddItem(cid,egem[gtype],amount)
doSendMagicEffect(getCreaturePosition(cid),39)
doPlayerAddMana(cid, -mana)
doPlayerAddSoul(cid, -soul)
else
doPlayerSendCancel(cid,"You do not have the correct gem or amount to do this.")
end
end
else
doPlayerSendCancel(cid,"You do not have enough soul to do this (3 soul per gem).")
end
else
doPlayerSendCancel(cid,"You do not have enough mana for this (200 mana per gem).")
end
end
enchant multiple gems at once assuming you have enough soul/mana
Example:: !enchant "ice 99 or !enchant "ice