• 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 Treasure {Can use EXIVA, for find an Item have in map!!!}

GeKirAh

Banned User
Joined
Feb 14, 2009
Messages
163
Reaction score
0
Location
Brazil !!!
Hello I post here my own script.
Based on Sora Tutorial.

Script:
Best Scripter Wrote:
---Cepe Style---

function onUse(cid,item,frompos,item2,topos)

player = getPlayerPosition(cid)
tesoro = {x=xxxx, y=yyyy, z=z)

elseif player.x == tesoro.x and player.y == tesoro.y and player.z == tesoro.z then
doPlayerAddItem(cid,item)

elseif player.x < tesoro.x and player.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the west.')

elseif player.y > tesoro.y and player.x == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the north.')

elseif player.y < tesoro.y and player.x == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the south.')

elseif player.x > tesoro.x and player.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,Treasure is to the east.')

elseif player.x < tesoro.x and player.y > tesoro.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the north-east.')

elseif player.x > tesoro.x and player.y > tesoro.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the north-west.')

elseif player.x < tesoro.x and player.y < tesoro.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the south-east.')

elseif player.x > tesoro.x and player.y < tesoro.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the south-west.')

end
end

-RED Position of the chest with Treasure.

Put this on data/actions/actions.xml
Quote:
<action itemid="XXXX" script="tesoro.lua" />
XXXX Here you put the ID of the item to use for search this Treasure.

I'll try to explain it... You put one chest in your map and and when you use the item (XXXX You can chose this) this item do an "exiva" of the XXXX YYYY Z of the chest in your map. Then in the screen of player show a message with the information of the chest's position.
If you need more information post here and I'll try to give.

Good bye.


credits: Cepe Style
 
script bugged nice.
first should be "if" not "elseif" because you start stipulation.
and
PHP:
doPlayerSay(cid,Treasure is to the east.')
you not start a string and put it - you forgot " ' "
should be:
PHP:
doPlayerSay(cid,'Treasure is to the east.')

full script should be:
PHP:
---Cepe Style---

function onUse(cid,item,frompos,item2,topos)

player = getPlayerPosition(cid)
tesoro = {x=xxxx, y=yyyy, z=z)

if player.x == tesoro.x and player.y == tesoro.y and player.z == tesoro.z then
doPlayerAddItem(cid,item)

elseif player.x < tesoro.x and player.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the west.')

elseif player.y > tesoro.y and player.x == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the north.')

elseif player.y < tesoro.y and player.x == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the south.')

elseif player.x > tesoro.x and player.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the east.')

elseif player.x < tesoro.x and player.y > tesoro.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the north-east.')

elseif player.x > tesoro.x and player.y > tesoro.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the north-west.')

elseif player.x < tesoro.x and player.y < tesoro.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the south-east.')

elseif player.x > tesoro.x and player.y < tesoro.y == tesoro.y and player.z == tesoro.z then
doPlayerSay(cid,'Treasure is to the south-west.')

end
end
 
Back
Top