• 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!

Tfs 0.3.6 - Script bugs/pvp enforced /Aol---- Read it please

Dalale

GX
Joined
Jun 13, 2008
Messages
718
Reaction score
2
Location
Sweden
Hello
Im using Tfs 0.3.6 and I want to have pvpe in my server.


Prob: 1
1. When im using pvp-e people are dropping items even when they use aol, but they gain experiance from players.

2. When i use regual Pvp players aint dropping items, but they aint getting experiance from players.

3. I want to have Pvp-E and also prevent the loss of items when using aol.

Prob2: Teleport scroll
As you can see in this script, if player got PZ he will not be able to use this TP scroll.
But the problem is, even if im white skulled and trying to kill somone i can just rightclick on the scroll and be teleported in the next 10 secounds.

(I want the script to work out, so if you are pz, you cant be teleported.)

Script
Code:
-- By Colandus LEAVE CREDITS
 
local countdown = 10
local name = "Roxor Temple"
 
local action = {}
 
local function teleport(p) 
	local cid, count = unpack(p)
	if(isPlayer(cid)) then
		local cancelled = not action[cid]
		local playerPos = getCreaturePosition(cid)
		if(not cancelled) then 
			if(getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then 
				doPlayerSendTextMessage(cid, 21, "Teleport cancelled because of being in a fight!")
				cancelled = true
			elseif(count > 0) then
				doCreatureSay(cid, "Teleporting in " .. count .. " seconds.", TALKTYPE_ORANGE_1)
				doSendAnimatedText(playerPos, "Teleport", TEXTCOLOR_RED)
				doSendMagicEffect(playerPos, CONST_ME_FIREATTACK)
				addEvent(teleport, 1000, {cid, count - 1})
			else
				doTeleportThing(cid, getPlayerMasterPos(cid)) 
				doPlayerSendTextMessage(cid, 21, "Teleported to the " .. name .. ".")
				doSendMagicEffect(playerPos, CONST_ME_ASSASSIN) 
 
				local playerPos = getCreaturePosition(cid)
				doSendMagicEffect(playerPos, CONST_ME_FIREATTACK)
				doSendMagicEffect(playerPos, CONST_ME_FIREAREA)
 
				action[cid] = false
			end
		end
 
		if(cancelled) then
			doSendAnimatedText(playerPos, "Cancelled", TEXTCOLOR_RED)
			action[cid] = false
		end
	end
end 
 
function onUse(cid, item, ppos, frompos, item2, topos)
	 
	if(getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then 
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot use a teleport scroll when you are in a fight.") 
	elseif(action[cid]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have cancelled the teleport.") 
		action[cid] = false
		return TRUE
	elseif(isExhausted(cid, 9143, countdown * 4) == 1) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The power of this scroll is too strong to be executed this fast.") 
	else
		action[cid] = true
		teleport({cid, countdown})
		setExhaust(cid, 9143)
	end
 
	if(action[cid] == false) then
		doSendMagicEffect(frompos, CONST_ME_POFF)
	end
	return TRUE 
end


Prob 3: Exura gran mas res/Exura sio"playername

1. This 2 spells are for druids, and its right, but the problem is when your standing in protection zone, you shuld not be able to execute this spell. I got it working on my 0.2 but in 0.3.6 i cant get it work.


Thanks for reading
If you don't understand my problems, then tell me
Ps: Sorry for my english..:$

Yours
Dalal£
 
Prob 1.
nothing wrong, this is how it works. to modify it, you will need to edit the sources

Prob 2
try this:

Lua:
local countdown = 10
local name = "Roxor Temple"
 
local action = {}
 
local function teleport(p) 
	local cid, count = unpack(p)
	if(isPlayer(cid)) then
		local cancelled = not action[cid]
		local playerPos = getCreaturePosition(cid)
		if(not cancelled) then 
			if isPlayerPzLocked(cid) then 
				doPlayerSendTextMessage(cid, 21, "Teleport cancelled because of being in a fight!")
				cancelled = true
			elseif(count > 0) then
				doCreatureSay(cid, "Teleporting in " .. count .. " seconds.", TALKTYPE_ORANGE_1)
				doSendAnimatedText(playerPos, "Teleport", TEXTCOLOR_RED)
				doSendMagicEffect(playerPos, CONST_ME_FIREATTACK)
				addEvent(teleport, 1000, {cid, count - 1})
			else
				doTeleportThing(cid, getPlayerMasterPos(cid)) 
				doPlayerSendTextMessage(cid, 21, "Teleported to the " .. name .. ".")
				doSendMagicEffect(playerPos, CONST_ME_ASSASSIN) 
 
				local playerPos = getCreaturePosition(cid)
				doSendMagicEffect(playerPos, CONST_ME_FIREATTACK)
				doSendMagicEffect(playerPos, CONST_ME_FIREAREA)
 
				action[cid] = false
			end
		end
 
		if(cancelled) then
			doSendAnimatedText(playerPos, "Cancelled", TEXTCOLOR_RED)
			action[cid] = false
		end
	end
end 
 
function onUse(cid, item, ppos, frompos, item2, topos)
	 
	if isPlayerPzLocked(cid) then 
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot use a teleport scroll when you are in a fight.") 
	elseif(action[cid]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have cancelled the teleport.") 
		action[cid] = false
		return TRUE
	elseif(isExhausted(cid, 9143, countdown * 4) == 1) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The power of this scroll is too strong to be executed this fast.") 
	else
		action[cid] = true
		teleport({cid, countdown})
		setExhaust(cid, 9143)
	end
 
	if(action[cid] == false) then
		doSendMagicEffect(frompos, CONST_ME_POFF)
	end
	return TRUE 
end

prob 3:

use
Lua:
getTilePzInfo(pos)
to check if you are in pz
 
thank you, i will try it, atm im working on getting the client to 8.6 and im getting this bug

2liu7ix.jpg


and yes i do have in config the right map name "roxor" and i have change in map editor to 8.6



EDIT1: The scroll script you send me dosnt work, still i can teleport even if i got pz (from creatures,and players)
About the problem 3, I didn't understand what you meant :(
 
Last edited:
worldType = "pvp"
I have ^that settings in config.lua


edit1: fixed the tp scroll, I found a script in the forum from somone, I dont really remember the name, creds to that guy.. anyway here it is

edit2: I got one "bug" with this script, its that the effects are showed up in the positions where i clicked on the teleport scroll, i want the effects to follow the player " (player,pos)

Code:
local newpos = {x=678, y=679, z=7} --New position
local buffer = 6 -- in seconds(time to wait to get tped)
local cooldown = 30 -- inseconds
local storage = 9075

--[[end of config]]-- 
function countDown(number, pos, effect, msgonend, effectonend)
  local n = number
       for i = 1, number do
           addEvent(doSendAnimatedText,i* 1000, pos, n > 1 and n.."" or msgonend .."", n < 6 and TEXTCOLOR_RED or TEXTCOLOR_GREEN)
		   addEvent(doSendMagicEffect,i* 1000, pos, n > 1 and effect or effectonend )
              n = n -1
	   end
      n = number
return true
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if(getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You may not use this while in fight.")
    return true
	end
	if not exhaustion.get(cid, storage) then
	    exhaustion.set(cid, storage, cooldown)
	   countDown(buffer, getThingPos(cid), 5, "Tped", 2)
	   addEvent(doTeleportThing,buffer * 1000,cid,newpos)
	else
	   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Cooldown : "..exhaustion.get(cid, storage).." seconds.")
	end
return true
end



Edit: changed worldtype from pvp to "open" and it worked out...


Edit2: Alright, the protocol 8.6 is working now, but i still got some problems, when i upgrade my map into 8.6 some npcs/creatures dissapear, and i have to add them again.... I am doing wrong?
 
Last edited:
Alright, sorry for so many edits, but i fixed the bugs on my own...

I still got problem with the bug problem 3, and if somone had time to fix my tp scroll to send the right magic effect at the right playerpos.
 
Sorry Otland if im spamming, but send me a pm if i disturb you :p

I got a new problem, about the shop system (Using tfs 0.4)
When im buying somth from the site, lets ex say a mace. I will get this items, but also i will get around 100 maces.
Ive been searching around and tried alot of scripts but none works, and ive seen that many got this problem.
here is my script

Code:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
    local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
    if(result_plr:getID() ~= -1) then
        while(true) do
            id = tonumber(result_plr:getDataInt("id"))
            action = tostring(result_plr:getDataString("action"))
            delete = tonumber(result_plr:getDataInt("delete_it"))
            cid = getCreatureByName(tostring(result_plr:getDataString("name")))
            if isPlayer(cid) == TRUE then
                local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
                local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
                local container_id = tonumber(result_plr:getDataInt("param3"))
                local container_count = tonumber(result_plr:getDataInt("param4"))
                local add_item_type = tostring(result_plr:getDataString("param5"))
                local add_item_name = tostring(result_plr:getDataString("param6"))
                local received_item = 0
                local full_weight = 0
                if add_item_type == 'container' then
                    full_weight = getItemWeightById(itemtogive_id, 1)
                end
                local free_cap = getPlayerFreeCap(cid)
                if full_weight <= free_cap then
                    if add_item_type == 'container' then
                        local new_container = doCreateItemEx(container_id, 1)
                        local iter = 0
                        while iter ~= container_count do
                            doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
                            iter = iter + 1
                        end
                        received_item = doPlayerAddItemEx(cid, new_container)
                    else
                        local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
                        received_item = doPlayerAddItemEx(cid, new_item)
                    end
                    if received_item == RETURNVALUE_NOERROR then
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
                        db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                        db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
						doPlayerSave(cid)
					else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                    end
                else
                        doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. Han error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
                end
            end
            if not(result_plr:next()) then
                break
            end
        end
        result_plr:free()
    end
    return TRUE
end


EXAMPEL
Code:
06:36 You received >> Mage Legs (5 points) << from OTS shop.
06:37 You received >> Mage Legs (5 points) << from OTS shop.
06:37 You received >> Mage Legs (5 points) << from OTS shop.
06:38 You received >> Mage Legs (5 points) << from OTS shop.
06:38 You received >> Mage Legs (5 points) << from OTS shop.
06:39 You received >> Mage Legs (5 points) << from OTS shop.
06:39 You received >> Mage Legs (5 points) << from OTS shop.
06:40 You received >> Mage Legs (5 points) << from OTS shop.
06:40 You received >> Mage Legs (5 points) << from OTS shop.
06:41 You received >> Mage Legs (5 points) << from OTS shop.
06:41 You received >> Mage Legs (5 points) << from OTS shop.
06:42 You received >> Mage Legs (5 points) << from OTS shop.
 
Last edited:
Back
Top