KylerXX
Active Member
- Joined
- Jun 24, 2010
- Messages
- 439
- Reaction score
- 30
Hello, I will present my teleport system.
Function:
If you are not in the sacred position, then you can not teleport, if you're in the sacred position, and you say for example <<tp hydras>>, you will be teleported to hydras.
First let's go to data/talkactions/scripts, and create a lua file called tp.lua, and then write in:
You can add more destinations adding this:
Now you go to talkactions.xml and add:
I hope you like it:thumbup:
Function:
If you are not in the sacred position, then you can not teleport, if you're in the sacred position, and you say for example <<tp hydras>>, you will be teleported to hydras.
First let's go to data/talkactions/scripts, and create a lua file called tp.lua, and then write in:
PHP:
function onSay(cid, words, param)
posx = getPlayerPosition(cid).x
posy = getPlayerPosition(cid).y
par = {
book = param == 'book', --param of book
hydra = param == 'hydras', -- param of destinations.
demon = param == 'demons',
pirate = param == 'pirates'
}
msg = {
nopos1 = 'Debes estar en el suelo sagrado.',
nomoney = 'No tienes suficiente dinero para utilizar este servicio.',
donetp = 'Has llegado con éxito.'
}
pos = {
hydra = {x = 95, y = 118, z = 7},
demon = {x = 1000, y = 1000, z = 7},
pirate = {x = 1000, y = 1000, z = 7}
} -- Destinos.
cost = {
tp = 50000, -- Cost of service
book = 10000, --Cost of book
money = getPlayerMoney(cid)-- player money
}
local money1 = getPlayerMoney(cid) > cost.tp
local money2 = getPlayerMoney(cid) < cost.book
pos1 = {x = 95, y = 117, z = 7} -- Sacred position
-- This is text of the book.
text = '* Remember that the cost of this service is 1 cc. \ nIf you want to use this exclusive service, you must remember to be vip, below, shows what you should say on the sacred position to go to different areas: \ ntp hydras, \ ntp demons, \ ntp pirates. \ n * The cost of such services is of 5 cc. "
---------- HYDRAS
if posx == pos1.x and posy == pos1.y and par.hydra and money1 then -- this indicates that if the player's position is equal to the principal, and say tp hydras and has more than 5 cc -It will run the below.
doTeleportThing(cid, pos.hydra)
doPlayerRemoveMoney(cid, 50000)
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.donetp)
doSendMagicEffect(pos.hydra, CONST_ME_TELEPORT)
elseif posx == pos1.x and posy == pos1.y and par.hydra and money2 then -- this indicates that if the player's position is equal to the principal and say tp hydtas and has lesst han de 5 cc--It will run the below.
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nomoney)
elseif posx ~= pos1.x and posy ~= pos1.y and par.hydra then -- this indicate that the player's position is not equal to the principal and say tp hydras, It will run the below.
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
elseif posx == pos1.x and posy ~= pos1.y and par.hydra then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
elseif posx ~= pos1.x and posy == pos1.y and par.hydra then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
----DEMONS
elseif posx == pos1.x and posy == pos1.y and par.demon and money1 then
doTeleportThing(cid, pos.demon)
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
doPlayerRemoveMoney(cid, 50000)
doSendMagicEffect(pos.demon, CONST_ME_TELEPORT)
elseif posx == pos1.x and posy == pos1.y and par.demon and money2 then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nomoney)
elseif posx ~= pos1.x and posy ~= pos1.y and par.demon then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
elseif posx == pos1.x and posy ~= pos1.y and par.demon then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
elseif posx ~= pos1.x and posy == pos1.y and par.demon then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
----PIRATES
elseif posx == pos1.x and posy == pos1.y and par.pirate and money1 then
doTeleportThing(cid, pos.pirate)
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.donetp)
doPlayerRemoveMoney(cid, 50000)
doSendMagicEffect(pos.pirate, CONST_ME_TELEPORT)
elseif posx == pos1.x and posy == pos1.y and par.pirate and money2 then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nomoney)
elseif posx ~= pos1.x and posy ~= pos1.y and par.pirate then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
elseif posx == pos1.x and posy ~= pos1.y and par.pirate then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
elseif posx ~= pos1.x and posy == pos1.y and par.pirate then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
---BOOK
elseif posx == pos1.x and posy == pos1.y and par.book and money1 then
addEvent(doShowTextDialog, 2000, cid, 7704, text)
doPlayerRemoveMoney(cid, 10000)
doSendMagicEffect(pos1, CONST_ME_POFF)
elseif posx == pos1.x and posy == pos1.y and par.book and money2 then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nomoney)
elseif posx ~= pos1.x and posy ~= pos1.y and par.book then
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
----------------------------
end
end
You can add more destinations adding this:
PHP:
---NAMEDESTINATION
elseif posx == pos1.x and posy == pos1.y and PARAM OF DEST and money1 then -- you can add on par table
doTeleportThing(cid, POSITION DESTINATION) -- you can add on table pos
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.donetp)
doPlayerRemoveMoney(cid, 50000)
doSendMagicEffect(pos.pirate, CONST_ME_TELEPORT)
elseif posx == pos1.x and posy == pos1.y and PARAM OF DEST and money2 then-- you can add on par table
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nomoney)
elseif posx ~= pos1.x and posy ~= pos1.y and PARAM OF DEST then-- you can add on par table
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
elseif posx == pos1.x and posy ~= pos1.y and PARAM OF DEST then-- you can add on par table
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
elseif posx ~= pos1.x and posy == pos1.y and PARAM OF DEST then-- you can add on par table
doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, msg.nopos1)
Now you go to talkactions.xml and add:
PHP:
<talkaction words="tp" event="script" value="tp.lua"/>
I hope you like it:thumbup: