• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Fixable stuff

Titanum

New Member
Joined
Feb 21, 2016
Messages
22
Reaction score
0
Greeting otlanders :D.
I've got some problems and i hope someone may help me with them, Thanks.
1- This script to charge a special weapon with runes what i need is to do limit for the charges MAX 300 charges.
local config = {
manaCost = 300,
soulCost = 2
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

if(item.itemid == 2280 and isInArray({8300}, itemEx.itemid)) then
doTransformItem(itemEx.uid, 4848, 1)
doRemoveItem(item.uid, 1)

doSendMagicEffect(getPlayerPosition(cid), 31)
return true
elseif(item.itemid == 2280 and isInArray({4848}, itemEx.itemid)) then
local subtype = itemEx.type
doTransformItem(itemEx.uid, 4848, subtype+1)
doRemoveItem(item.uid, 1)

doSendMagicEffect(getPlayerPosition(cid), 31)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You may only use it on arrow of disaster.")
return true
end


if(isInArray(enchantableGems, item.itemid)) then
local subtype = item.type
if(subtype == 0) then
subtype = 1
end

local mana = config.manaCost
if(getPlayerMana(cid) < mana) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
return true
end

local soul = config.soulCost
if(getPlayerSoul(cid) < soul) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHSOUL)
return true
end

local a = table.find(enchantableGems, item.itemid)
if(a == nil or not isInArray(enchantingAltars[a], itemEx.itemid)) then
return false
end
local info = getItemInfo(enchantedGems[a])
doTransformItem(item.uid, enchantedGems[a], info.charges)
doPlayerAddMana(cid, -mana)
doPlayerAddSoul(cid, -soul)

doPlayerAddSpentMana(cid, mana)
doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
return true
end


local b = table.find(enchantedGems, item.itemid)
if(b == nil) then
return false
end

local subtype = itemEx.type
if(not isInArray({8300, 8300}, itemEx.itemid)) then
subtype = 1000
end

doTransformItem(itemEx.uid, enchantedItems[itemEx.itemid], subtype)
doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYDAMAGE)
doDecayItem(itemEx.uid)
doRemoveItem(item.uid, 1)
return true
end
2- This script is for npc who is selling coins for special id as you see (9971, 10) and its working good but when i'm trying to buy more than 1 like 10 or something it's still buys only 1 not more :S
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local shopWindow = {}
local keys = {
{id = 10571, buy = 10, name = "COIN"}
}
local cost = {9971, 10}

local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
if doPlayerRemoveItem(cid, cost[1], cost[2]) then
local thing = doPlayerAddItem(cid, shopWindow[item].ID)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have bought a "..shopWindow[item].KeyName.." for gold.")
else
selfSay("You don't have enough money.", cid)
end
return true
end


function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end

if msgcontains(msg, 'trade') then
for var, item in pairs(keys) do
shopWindow[item.id] = {ID = item.id, Price = item.buy, KeyName = item.name}
end
openShopWindow(cid, keys, onBuy, onSell)
end
return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
3- I need to do broadcast message before this raid hmmm tried to do globalevent scripts and i've done it but they doesn't match together with the time :S so i need to do broadcast before every raid
<?xml version="1.0" encoding="UTF-8" ?>
- <raid>
<singlespawn delay="1" name="Devento" ref="yes" x="996" y="993" z="7" />
</raid>
<?xml version="1.0" encoding="UTF-8" ?>
- <raids>
<raid name="Devento" file="Devento.xml" interval2="60" margin="0" reftype="block" ref="no" />
- <!--
executed on average once every 2 minutes

<raid name="Example" file="example.xml" interval2="2" margin="0" reftype="single" ref="no"/>
won't be executed again till Cave Rat gets killed

<raid name="Example2" file="example.xml" interval2="2" margin="0" reftype="block" ref="no"/>
will stay as 'running' until Cave Rat gets killed

-->
</raids>
4- This one is with gesior latest news, you will understand from the photo that i can't make a post on news page and i already have admin access, and the version of gesior that i have doesn't support admin panel :S
11azllh.jpg

TFS 0.4


Hmm is it hard to solve?
EDIT
Website- solved
Raid- Solved
NPC- NOT SOLVED
WAND- NOT SOLVED :S
 
Last edited:
About problem with site acess, I think you didn't change "page_acess".
Page access? i think i've told you that gesior didn't support admin account panel :S and when i tried to change access to 6 at forum.php somehow all players could post on news forum
 
Page access? i think i've told you that gesior didn't support admin account panel :S and when i tried to change access to 6 at forum.php somehow all players could post on news forum
I have got page_access="3" on my GOD character, and I can write news. Normal player with pageaccess="3" same.
I'm using GESIOR.
 
In your PhP database, there should be a tab called "page_acces" just aswell as "player_id", "group", "level" etc. etc.

EDIT:
I can't remember if it's account wide or individual characters.
 
In your PhP database, there should be a tab called "page_acces" just aswell as "player_id", "group", "level" etc. etc.

EDIT:
I can't remember if it's account wide or individual characters.
I'll check it but after i write my access on my page access, what i will do more?
 
Code:
<raid>
<announce delay="1000" type="event" message="Devento is coming home tonight." />

  <!--Area Spawns-->
  <areaspawn delay="2000" fromx="996" fromy="993" fromz="7" tox="996" toy="993" toz="7">
  <monster name="Devento" amount="1" />
  </areaspawn>

</raid>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<raids>
<raid name="devento" file="devento.xml" interval2="30" margin="0" reftype="single" ref="yes"/>
</raids>
I dunno how they work..
I'm just kind of copy pasting from my raids folder. :P
 
Code:
local maxCharges = 300
if getItemInfo(item.itemid).charges >= maxCharges then
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Max amount of charges reached.")
    return true
end

Code:
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
    if doPlayerRemoveItem(cid, cost[1], cost[2] * amount) then
        local thing = doPlayerAddItem(cid, shopWindow[item].ID, amount)
The code looks incorrect, but you said it works... so who am i to fix it.
 
Last edited by a moderator:
Code:
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
    if doPlayerRemoveItem(cid, cost[1], cost[2] * amount) then
        local thing = doPlayerAddItem(cid, shopWindow[item].ID, amount)
The code looks incorrect, but you said it works... so who am i to fix it.

thanks
 
Back
Top