• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Repair your Firewalker and Soft Boots with one Click !

Nubaza

LUA Scripter
Joined
Jun 5, 2011
Messages
330
Solutions
1
Reaction score
22
Location
New Zeland
I've made a simple script for repair instantly your boots with a simple click!

scaled.php


First go to data/actions/scripts/...
create a repair.lua and remplace with this:

Lua:
-- Script by Nubaza (chavoz) otland.net

local boots = {
	[10021] = {id = 6132, money = 0},
	[10022] = {id = 9933, money = 0}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if boots[item.itemid] then
		if doPlayerRemoveMoney(cid, boots[item.itemid].money) then
			doTransformItem(item.uid, boots[item.itemid].id)
		doSendMagicEffect(getCreaturePosition(cid),28)
doPlayerSendTextMessage(cid,27,"You have successfully repaired your boots.")
		else
			doPlayerSendCancel(cid, RET_NOTENOUGHMONEY)
		end
	end
	return true
end

Add this tag to actions.xml
Code:
    <action itemid="10021;10022" event="script" value="repair.lua"/>

Done.
A simple script, with a simple function.

Credits:
otland.net (Nubaza)
 
Last edited:
if i want it cost. So its on gold coins or?

money = 0 put your own value there.

Script seems fine, but what's the point of adding duration to these boots anyway if you can fix them by single click.... Good old repair NPC makes more sense, but who knows this new generation with talking signs, addon dolls and overpowered spells might like it for their server.
 
Hahah, yeh, you're right..
Also with this script you can delete the repair NPC, because much NPCs in the map cause lag.
 
for Revscript??? please

You can learn right here on GitHub how to convert to RevScripts, it's very easy...

I did it here for you.
Lua:
local boots = {
    [10021] = {id = 6132, money = 0},
    [10022] = {id = 9933, money = 0}
}

local testAction = Action() -- this is our header, the first thing we have to write (except for configuration tables and such)

function testAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
    if boots[item.itemid] then
        if player:removeMoney(boots[item.itemid].money) then
            item:transform(boots[item.itemid].id)
            fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have successfully repaired your boots.")
        else
            player:sendCancelMessage(RETURNVALUE_NOTENOUGHMONEY)
        end
    end
    return true
end

for index, _ in pairs(boots) do
    testAction:id(index)
end

testAction:register() -- this is our footer, it has to be the last function executed
 
and how add if VIP only?
using the function player:isPremium() or if you are using it through storage player:getStorageValue()

Code:
function testAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
    if boots[item.itemid] then
        if player:removeMoney(boots[item.itemid].money) then
            if not player:isPremium() then
                item:transform(boots[item.itemid].id)
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have successfully repaired your boots.")
            else
                player:sendCancelMessage("You need to be premium.")  
            end
        else
            player:sendCancelMessage("You don't have enough money, you need [100K].")
        end
    end
    return true
end
 
using the function player:isPremium() or if you are using it through storage player:getStorageValue()

Code:
function testAction.onUse(player, item, fromPosition, target, toPosition, isHotkey) -- now we can design the action itself
    if boots[item.itemid] then
        if player:removeMoney(boots[item.itemid].money) then
            if not player:isPremium() then
                item:transform(boots[item.itemid].id)
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have successfully repaired your boots.")
            else
                player:sendCancelMessage("You need to be premium.") 
            end
        else
            player:sendCancelMessage("You don't have enough money, you need [100K].")
        end
    end
    return true
end
in order to premium player use it only i should change
Lua:
if not player:isPremium() then to if player:isPremium() then
right?
 
Back
Top