cabrera2608
New Member
- Joined
- Dec 21, 2018
- Messages
- 110
- Solutions
- 1
- Reaction score
- 4
anyone know why it doesn't work.
for example it does not serve as KNIFE or as a machete
but if it works as a shovel and rope pick I leave you my files
squeeze.lua
actions.xml
Lib
for example it does not serve as KNIFE or as a machete
but if it works as a shovel and rope pick I leave you my files
squeeze.lua
Lua:
local config = {
functions = {
[10511] = { -- sneaky stabber of eliteness
TOOLS.ROPE,
TOOLS.SHOVEL,
TOOLS.PICK,
TOOLS.MACHETE,
TOOLS.KNIFE
},
[10513] = { -- squeezing gear of girlpower
TOOLS.ROPE,
TOOLS.SHOVEL,
TOOLS.PICK,
TOOLS.MACHETE,
TOOLS.SCYTHE
},
[10515] = { -- whacking driller of fate
TOOLS.ROPE,
TOOLS.SHOVEL,
TOOLS.PICK,
TOOLS.MACHETE,
TOOLS.KNIFE
}
},
jamChance = 10
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local funcs = config.functions[item.itemid]
if(funcs == nil) then
return false
end
local result = false
for _, func in ipairs(funcs) do
if(func(cid, item, fromPosition, itemEx, toPosition)) then
result = true
break
end
end
if(not result) then
return false
end
if(math.random(1, 100) <= config.jamChance) then
doTransformItem(item.uid, item.itemid + 1)
doDecayItem(item.uid)
end
return true
end
actions.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<!-- Default script, responsible for destroyItem -->
<action default="yes" event="script" value="default.lua"/>
<!-- Quests -->
<action actionid="2000" event="script" value="quests/system.lua"/>
<action itemid="1740;1747-1749" event="script" value="quests/quests.lua"/>
<!-- Text -->
<action itemid="1957;7722;10122" event="script" value="other/text.lua"/>
<!-- Weapons enchanting (Gems) -->
<action itemid="2146-2147;2149-2150;7759-7762" event="script" value="other/enchanting.lua"/>
<!-- Change gold -->
<action itemid="2148;2152;2160" event="script" value="other/changegold.lua"/>
<!-- Tools -->
<action itemid="2420;2442" event="script" value="tools/machete.lua"/>
<action itemid="2550" event="script" value="tools/scythe.lua"/>
<action itemid="2580;10223" event="script" value="tools/fishing.lua" allowfaruse="1"/>
<action itemid="2554;5710" event="script" value="tools/shovel.lua"/>
<action itemid="2120;7731" event="script" value="tools/rope.lua"/>
<action itemid="2553" event="script" value="tools/pick.lua"/>
<action itemid="5908;5942" event="script" value="tools/skinning.lua"/>
<action itemid="10511;10513;10515" event="script" value="tools/squeeze.lua"/>
<!-- Consumables (Liquids+Foods) -->
<action itemid="1775;2005-2009;2011-2015;2023;2031-2034;2562;2574-2577;3941-3942;5553;10150" event="script" value="liquids/containers.lua"/>
<action itemid="6558" event="script" value="liquids/demonic_blood.lua"/>
<action itemid="7588-7591;8472-8473;7618;7620;8704" event="script" value="liquids/potions.lua"/>
<action itemid="7439" event="script" value="liquids/berserk_potion.lua"/>
<action itemid="7440" event="script" value="liquids/mastermind_potion.lua"/>
<action itemid="7443" event="script" value="liquids/bullseye_potion.lua"/>
<action itemid="8474" event="script" value="liquids/antidote_potion.lua"/>
<action itemid="2328;2362;2666-2691;2695-2696;2787-2796;5097;5678;6125;6278-6279;6393-6394;6501;6541-6545;6569;6574;7158-7159;7245;7372-7377;7909;7963;8112;8838-8845;8847;9005;9114;10454;11246;11429;12415-12418;12637-12639" event="script" value="foods/food.lua"/>
<action itemid="9992" event="script" value="foods/rotworm_stew.lua"/>
<action itemid="9993" event="script" value="foods/hydra_tongue_salad.lua"/>
<action itemid="9994" event="script" value="foods/roasted_dragon_wings.lua"/>
<action itemid="9995" event="script" value="foods/fried_tropical_terrorbird.lua"/>
<action itemid="9996" event="script" value="foods/banana_chocolate_shake.lua"/>
<action itemid="9997" event="script" value="foods/veggie_casserole.lua"/>
<action itemid="9998" event="script" value="foods/filled_jalapeno_peppers.lua"/>
<action itemid="9999" event="script" value="foods/blessed_steak.lua"/>
<action itemid="10000" event="script" value="foods/carrot_cake.lua"/>
<action itemid="10001" event="script" value="foods/northern_fishburger.lua"/>
<action itemid="12540" event="script" value="foods/coconut_shrimp_bake.lua"/>
<action itemid="12542" event="script" value="foods/pot_of_blackjack.lua"/>
<action itemid="12543" event="script" value="foods/demonic_candy_ball.lua"/>
<action itemid="12544" event="script" value="foods/sweet_mangonaise_elixir.lua"/>
<!-- Spellbooks -->
<action itemid="2175;6120;8190;8900-8904;8918;12647" event="script" value="other/spellbook.lua"/>
<!-- Construction kits -->
<action itemid="3901-3938;5086-5088;6114-6115;6372-6373;7503;7700;7960-7962;8692-8693;9974;10295" event="script" value="other/constructionkits.lua"/>
<action itemid="7904-7907" event="script" value="other/furniturebeds.lua"/>
<!-- Music, instruments -->
<action itemid="2070-2085;2094-2095;2332;2364;2367-2374;3951-3953;3957;5786;6123;9561;6572" event="script" value="other/music.lua"/>
<!-- Teleport (stairs, ladders) -->
<action itemid="430;1369;1386;3678;5543;8580;8599;10035;13010" event="script" value="other/teleport.lua"/>
<!-- Bread Creating -->
<action itemid="2692;2694" event="script" value="other/createbread.lua"/>
<!-- Doors -->
<!-- Doors -->
<action itemid="1209-1214;1219-1262;1539-1542;3535-3552;4913-4918;5082-5085;5098-5145;5278-5295;5515-5518;5732-5737;5745-5749;6192-6209;6249-6266;6795-6802;6891-6908;7033-7050;7054-7057;8541-8558;9165-9184;9267-9284;10268-10285;10468-10486;10775-10777;10780-10786;10789-10792;12092-12105;12188-12190;12193-12199;12202-12205" event="script" value="other/doors.lua"/>
<!-- Keys -->
<action itemid="2086-2092;10032;10091" event="script" value="other/keys.lua"/>
<!-- Windows -->
<action itemid="5303-5305;6436-6473;6788-6791;7025-7032;10264-10267;10488-10491" event="script" value="other/windows.lua"/>
<!-- Watches -->
<action itemid="1728-1731;1877;1881;2036;6091-6092;8187" event="script" value="other/watch.lua"/>
<!-- Reaction -->
<action itemid="5080;5669;5791;6512;6388;6566;8974;8977;8981;8982" event="script" value="other/reaction.lua"/>
<action itemid="8985;9002;9004;10018;10063-10064;10107-10108;10318;10718-10719" event="script" value="other/reaction.lua"/>
<!-- Other -->
<action itemid="2566;2096" event="script" value="other/pumpkinhead.lua"/>
<action itemid="2114" event="script" value="other/piggybank.lua"/>
<action itemid="2600" event="script" value="tools/inkwell.lua"/>
<action itemid="2785" event="script" value="other/blueberrybush.lua"/>
<action itemid="5792-5797" event="script" value="other/dice.lua"/>
<action itemid="6570-6571" event="script" value="other/surprisebag.lua"/>
<action itemid="6576" event="script" value="other/fireworksrocket.lua"/>
<action itemid="6578" event="script" value="other/partyhat.lua"/>
<action itemid="8110" event="script" value="other/present.lua"/>
<action itemid="7735" event="script" value="other/spellwand.lua"/>
<action itemid="7537;7585" event="script" value="other/spideregg.lua" />
<action itemid="6561;12424" event="script" value="other/blessings.lua"/>
<!-- offLineTraining -->
<action itemid="1444;1448;1449;3705;3739" event="script" value="other/offlinetraining.lua"/>
</actions>
Lib
Lua:
SPOTS = { 384, 418, 8278, 8592 }
ROPABLE = { 294, 369, 370, 383, 392, 408, 409, 427, 428, 430, 462, 469, 470, 482, 484, 485, 489, 924, 3135, 3136, 7933, 7938, 8170, 8286, 8285,
8284, 8281, 8280, 8279, 8277, 8276, 8323, 8380, 8567, 8585, 8596, 8595, 8249, 8250, 8251, 8252, 8253, 8254, 8255, 8256, 8972, 9606, 9625 }
HOLES = { 468, 481, 483, 7932, 8579 }
SAND = { 231, 9059 }
JUNGLE_GRASS = { 2782, 3985 }
SPIDER_WEB = { 7538, 7539 }
BAMBOO_FENCE = { 3798, 3799 }
WILD_GROWTH = { 1499, 11099 }
PUMPKIN = 2683
PUMPKIN_HEAD = 2096
POOL = 2016
SPECIAL_FOODS = {
[9992] = "Gulp.", [9993] = "Chomp.", [9994] = "Chomp.", [9995] = "Chomp.", [9997] = "Yum.",
[9998] = "Munch.", [9999] = "Chomp.", [10000] = "Mmmm.", [10001] = "Smack.", [12540] = "Yum.",
[12542] = "Gulp.", [12543] = "?", [12544] = "Slurp!"
}
DOORS = {
[1209] = 1211, [1212] = 1214, [1231] = 1233, [1234] = 1236, [1249] = 1251, [1252] = 1254, [3535] = 3537, [3544] = 3546, [4913] = 4915, [4916] = 4918,
[5098] = 5100, [5107] = 5109, [5116] = 5118, [5125] = 5127, [5134] = 5136, [5137] = 5139, [5140] = 5142, [5143] = 5145, [5278] = 5280, [5281] = 5283,
[5732] = 5734, [5735] = 5737, [6192] = 6194, [6195] = 6197, [6249] = 6251, [6252] = 6254, [6891] = 6893, [6900] = 6902, [7033] = 7035, [7042] = 7044,
[8541] = 8543, [8544] = 8546, [9165] = 9167, [9168] = 9170, [9267] = 9269, [9270] = 9272, [10268] = 10270, [10271] = 10273, [10468] = 10470,
[10477] = 10479, [10775] = 10777, [10784] = 10786, [12092] = 12094, [12099] = 12101, [12188] = 12190, [12197] = 12199
}
function destroyItem(cid, itemEx, toPosition)
if(itemEx.uid <= 65535 or itemEx.actionid > 0) then
return false
end
if(isInArray(SPIDER_WEB, itemEx.itemid)) then
if math.random(3) == 1 then
doTransformItem(itemEx.uid, (itemEx.itemid + 6))
doDecayItem(itemEx.uid)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
if(isInArray(BAMBOO_FENCE, itemEx.itemid)) then
if math.random(3) == 1 then
if(itemEx.itemid == BAMBOO_FENCE[1]) then
doTransformItem(itemEx.uid, (itemEx.itemid + 161))
elseif(itemEx.itemid == BAMBOO_FENCE[2]) then
doTransformItem(itemEx.uid, (itemEx.itemid + 159))
end
doDecayItem(itemEx.uid)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
if not(isInArray({1770, 2098, 1774, 1775, 2064, 2094, 2095, 1619, 2602, 3805, 3806}, itemEx.itemid) or
(itemEx.itemid >= 1724 and itemEx.itemid <= 1741) or
(itemEx.itemid >= 2581 and itemEx.itemid <= 2588) or
(itemEx.itemid >= 1747 and itemEx.itemid <= 1753) or
(itemEx.itemid >= 1714 and itemEx.itemid <= 1717) or
(itemEx.itemid >= 1650 and itemEx.itemid <= 1653) or
(itemEx.itemid >= 1666 and itemEx.itemid <= 1677) or
(itemEx.itemid >= 1614 and itemEx.itemid <= 1616) or
(itemEx.itemid >= 3813 and itemEx.itemid <= 3820) or
(itemEx.itemid >= 3807 and itemEx.itemid <= 3810) or
(itemEx.itemid >= 2080 and itemEx.itemid <= 2085) or
(itemEx.itemid >= 2116 and itemEx.itemid <= 2119)) then
return false
end
if(math.random(1, 7) == 1) then
if(isInArray({1738, 1739, 1770, 2098, 1774, 1775, 2064}, itemEx.itemid) or
(itemEx.itemid >= 2581 and itemEx.itemid <= 2588)) then
doCreateItem(2250, 1, toPosition)
elseif((itemEx.itemid >= 1747 and itemEx.itemid <= 1749) or itemEx.itemid == 1740) then
doCreateItem(2251, 1, toPosition)
elseif((itemEx.itemid >= 1714 and itemEx.itemid <= 1717)) then
doCreateItem(2252, 1, toPosition)
elseif((itemEx.itemid >= 1650 and itemEx.itemid <= 1653) or
(itemEx.itemid >= 1666 and itemEx.itemid <= 1677) or
(itemEx.itemid >= 1614 and itemEx.itemid <= 1616) or
(itemEx.itemid >= 3813 and itemEx.itemid <= 3820) or
(itemEx.itemid >= 3807 and itemEx.itemid <= 3810)) then
doCreateItem(2253, 1, toPosition)
elseif((itemEx.itemid >= 1724 and itemEx.itemid <= 1737) or
(itemEx.itemid >= 2080 and itemEx.itemid <= 2085) or
(itemEx.itemid >= 2116 and itemEx.itemid <= 2119) or
isInArray({2094, 2095}, itemEx.itemid)) then
doCreateItem(2254, 1, toPosition)
elseif((itemEx.itemid >= 1750 and itemEx.itemid <= 1753) or isInArray({1619, 1741}, itemEx.itemid)) then
doCreateItem(2255, 1, toPosition)
elseif(itemEx.itemid == 2602) then
doCreateItem(2257, 1, toPosition)
elseif(itemEx.itemid == 3805 or itemEx.itemid == 3806) then
doCreateItem(2259, 1, toPosition)
end
doRemoveItem(itemEx.uid, 1)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
TOOLS = {}
TOOLS.ROPE = function(cid, item, fromPosition, itemEx, toPosition)
if(toPosition.x == CONTAINER_POSITION) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
toPosition.stackpos = STACKPOS_GROUND
errors(false)
local ground = getThingFromPos(toPosition)
errors(true)
if(isInArray(SPOTS, ground.itemid)) then
doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
return true
elseif(isInArray(ROPABLE, itemEx.itemid)) then
local canOnlyRopePlayers = getBooleanFromString(getConfigValue('canOnlyRopePlayers'))
local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if(canOnlyRopePlayers) then
if(isPlayer(hole.uid) and (not isPlayerGhost(hole.uid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(hole.uid))) then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
else
if(hole.itemid > 0) then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
end
return true
end
return false
end
TOOLS.PICK = function(cid, item, fromPosition, itemEx, toPosition)
errors(false)
local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND})
errors(true)
if(isInArray(SPOTS, ground.itemid) and isInArray({354, 355}, itemEx.itemid) and item.actionid ~= 100) then
doTransformItem(itemEx.uid, 392)
doDecayItem(itemEx.uid)
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
if(itemEx.itemid == 7200) then
doTransformItem(itemEx.uid, 7236)
doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
return true
end
return false
end
TOOLS.MACHETE = function(cid, item, fromPosition, itemEx, toPosition, destroy)
if(isInArray(JUNGLE_GRASS, itemEx.itemid)) then
doTransformItem(itemEx.uid, itemEx.itemid - 1)
doDecayItem(itemEx.uid)
return true
end
if(isInArray(SPIDER_WEB, itemEx.itemid)) then
if math.random(3) == 1 then
doTransformItem(itemEx.uid, (itemEx.itemid + 6))
doDecayItem(itemEx.uid)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
if(isInArray(BAMBOO_FENCE, itemEx.itemid)) then
if math.random(3) == 1 then
if(itemEx.itemid == BAMBOO_FENCE[1]) then
doTransformItem(itemEx.uid, (itemEx.itemid + 161))
elseif(itemEx.itemid == BAMBOO_FENCE[2]) then
doTransformItem(itemEx.uid, (itemEx.itemid + 159))
end
doDecayItem(itemEx.uid)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
return true
end
if(isInArray(WILD_GROWTH, itemEx.itemid)) then
doSendMagicEffect(toPosition, CONST_ME_POFF)
doRemoveItem(itemEx.uid)
return true
end
return destroy and destroyItem(cid, itemEx, toPosition) or false
end
TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition)
if(isInArray(HOLES, itemEx.itemid)) then
local newId = itemEx.itemid + 1
if(itemEx.itemid == 8579) then
newId = 8585
end
doTransformItem(itemEx.uid, newId)
doDecayItem(itemEx.uid)
elseif(isInArray(SAND, itemEx.itemid)) then
local rand = math.random(1, 100)
local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND})
if(isInArray(SPOTS, ground.itemid) and rand <= 20) then
doTransformItem(itemEx.uid, 489)
doDecayItem(itemEx.uid)
elseif(rand >= 1 and rand <= 5) then
doCreateItem(2159, 1, toPosition)
elseif(rand > 85) then
doCreateMonster("Scarab", toPosition, false)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
return true
end
TOOLS.SCYTHE = function(cid, item, fromPosition, itemEx, toPosition, destroy)
if(itemEx.itemid == 2739) then
doTransformItem(itemEx.uid, 2737)
doCreateItem(2694, 1, toPosition)
doDecayItem(itemEx.uid)
return true
end
return destroy and destroyItem(cid, itemEx, toPosition) or false
end
TOOLS.KNIFE = function(cid, item, fromPosition, itemEx, toPosition)
if(itemEx.itemid ~= PUMPKIN) then
return false
end
doTransformItem(itemEx.uid, PUMPKIN_HEAD)
return true
end