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

Hard quests [Looks easy] but hard :P

Sir Shutter

Learning LUA
Joined
Nov 17, 2008
Messages
1,437
Reaction score
10
Location
Egypt
I got some scripts, I want them fixed, they are easy, but its hard to fix it.. well they are 2 scripts I want to fix

-: Script 1 :-​

Code:
function onStepIn(cid, item, pos)
	if item.uid == 2616 then
		doPlayerSetTown(cid, 1)
		doPlayerSendTextMessage(cid, 20, Welcome to Hawai!')
		doSendMagicEffect({x=199,y=483,z=7},13)
	end
-: Script 2 :-​

Code:
-----------------------By Nahruto-------------------------- 
-------------------http://otfans.net/---------------------- 
 function getPlayerMoney(cid) 
gold = getPlayerItemCount(cid,2148) 
plat = getPlayerItemCount(cid,2152)*100 
crys = getPlayerItemCount(cid,2160)*10000 
money = gold + plat + crys 
return money 
end 
local items = { 
    ["aol"] = {cash=10000, id=2173, amount=1}, 
    ["food"] = {cash=2000, id=2671, amount=100}, 
    ["backpack"] = {cash=100, id=1988, amount=1} 
}  
---------End Config --------- 
function onSay(cid, words, param) 
bitem = items[param] 
        if (bitem ~= nil) then 
            if getPlayerMoney(cid) >= bitem.cash then 
                doPlayerAddItem(cid,bitem.id,bitem.amount) 
                doPlayerRemoveMoney(cid,bitem.cash) 
            else 
                doPlayerSendCancel(cid,"Sorry, you dont have enough money") 
            end 
        else 
            doPlayerSendCancel(cid, "Invalid item.")             
        end 
return 1 
end

More Information!!

In script 1 this is added to the movements.xml

Code:
        <movevent event="StepIn" itemid="1387" script="residence.lua"/>

In script 2 this is added to the talkactions.xml

Code:
	<talkaction words="!buy" script="buy.lua" />

The problem in script 1 is when i go on the teleport it just change my temple position, but it dont send the effect, neither it says "Welcome to Hawai!" I checked the itemID, I checked the position , I checked the unique id, everything is correct..

The problem in script 2 is when i say !buy "aol it says "Invalid item", I tryed !buy "backpack still invalid item, nothing works.

This may help :-

1. Im using TFS
2.TFS Version : 0.3.2.1345
3.For tibia 8.40 server.


Rep++

If you help :thumbup:
 
Code:
local words = "Welcome to Haway!"
local itemID = 2616



function onStepIn(cid, item, pos)
	if item.uid == 2616 then
		doPlayerSetTown(cid, 1)
		doPlayerSendTextMessage(cid, 20, (cid, "Welcome to Hawai!")
		doSendMagicEffect({x=199,y=483,z=7},13)
	end
	else
	do sendPlayerCancel (cid,"Sorry you arent in Hawai!!!")
	elseif item.uid == 2616 then
			doPlayerSetTown(cid, 1)
		    doPlayerSendTextMessage(cid, 20, (cid, "Welcome to Hawai!")
		    doSendMagicEffect({x=199,y=483,z=7},13)
    return true
	end

try this for the first one..
 
First one!!

PHP:
function onStepIn(cid, item, position,fromPosition)
	if item.uid == 2616 then
		doPlayerSetTown(cid, 1)
		doPlayerSendTextMessage(cid, 20, "Welcome to Hawai!")
		doSendMagicEffect({x=199,y=483,z=7},13)
	end
end

Try this
 
Code:
        <movevent event="StepIn" itemid="1387" script="residence.lua"/>

Change for

Code:
        <movevent event="StepIn" uniqueid="2616" script="residence.lua"/>

And in the map for this sqm give unique id 2616
Beacuse it's onstepin, not use ...
 
This is the first one
PHP:
function onStepIn(cid, item, position,fromPosition) 
local townName = "Thais"
local townId = 1
    if item.uid == 2616 then
        doPlayerSetTown(cid, townId)
        doPlayerSendTextMessage(cid, 20, "Your hometown is now "..townName..".")
        doSendMagicEffect(getPlayerPosition(cid),13)
end
      return TRUE
    end
gonna check the other.

other one
PHP:
local items = { 
    ["aol"] = {cash=10000, id=2173, amount=1}, 
    ["food"] = {cash=2000, id=2671, amount=100}, 
    ["backpack"] = {cash=100, id=1988, amount=1} 
}  
---------End Config --------- 
function onSay(cid, words, param) 
bitem = items[param] 
        if (bitem ~= nil) then 
            if getPlayerMoney(cid) >= bitem.cash then 
                doPlayerAddItem(cid,bitem.id,bitem.amount) 
                doPlayerRemoveMoney(cid,bitem.cash) 
            else 
                doPlayerSendCancel(cid,"Sorry, you dont have enough money") 
            end 
        else 
            doPlayerSendCancel(cid, "Invalid item.")             
        end 
return TRUE
end
not changed anything just removed the function getPlayerMoney since there is already now in the latest TFS.

reputation if work:)
 
Last edited by a moderator:
Back
Top