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

[Request] Talkaction script

Zerville

New Member
Joined
Sep 19, 2008
Messages
47
Reaction score
0
I have really tried to learn more about scripting and make some by myself, wasnt as easy as I thought... but still I want the script!

The script im talking about is a talkaction thats used instead of a boat npc.
Example:
!travel desert
You are standing on the boat (or just a special pos) and as you typed !travel desert it takes money and checks lvl+premmy then teleports you to the position.
I have worked on it a bit myself but dont wanna post it here since i figured it was completely useless and a totally failed scripting :blink:
Anyone who could make this will get rep and creds on my coming OT
Amaltea.no-ip.org - you can always check the site ;)
 
I have really tried to learn more about scripting and make some by myself, wasnt as easy as I thought... but still I want the script!

The script im talking about is a talkaction thats used instead of a boat npc.
Example:
!travel desert
You are standing on the boat (or just a special pos) and as you typed !travel desert it takes money and checks lvl+premmy then teleports you to the position.
I have worked on it a bit myself but dont wanna post it here since i figured it was completely useless and a totally failed scripting :blink:
Anyone who could make this will get rep and creds on my coming OT
Amaltea.no-ip.org - you can always check the site ;)


Try this:
add this in talkactions.xml
Code:
	<talkaction words="!desert" script="travel.lua" />

travel.lua
Code:
local cost = 100 --------- Price of the trip
local pos = {{x=10, y=10, z=7}} -- position to teleport.
local posfrom = {{x=10, y=10, z=7}} -- position where the player needs to stand.


function onSay(cid, words, param)
if getPlayerPremiumDays(cid) => 1 then
if doPlayerRemoveMoney(cid, cost) == 1 then
if getCreaturePosition(cid) == posfrom then
doTeleportThing(cid, pos)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
else
doPlayerSendCancel(cid, 'You cant get teleported, please stand on the right tile.')
else
doPlayerSendCancel(cid, 'You need to be premium to use this travel function.')
else
doPlayerSendCancel(cid, 'You don\'t have enough money.')
end
   end

Remember this script isen't tested yet i made it in a hurry..
The pos spot is bugged but i cant fix it now since i'm in a hurry.
 
Last edited:
@nb up, you are missing ends after every else, your scripting is poor, doesnt matter if in hurry.
 
Well small buggs in it i fixed but it will still not work.
Might be as you typed "the pos spot is bugged"
Once i use this script and ingame type !travel (at the supposed spot) it says "You cant get teleported, please stand on the right tile"
Note: that positions are test...
Code:
local cost = 100 --------- Price of the trip
local pos = {{x=428, y=514, z=6}} -- position to teleport.
local posfrom = {{x=428, y=513, z=6}} -- position where the player needs to stand.


function onSay(cid, words, param)
if getPlayerPremiumDays(cid) >= 1 then
if doPlayerRemoveMoney(cid, cost) == 1 then
if getCreaturePosition(cid) == posfrom then
doTeleportThing(cid, pos)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
else
doPlayerSendCancel(cid, 'You cant get teleported, please stand on the right tile.')
end
else
doPlayerSendCancel(cid, 'You need to be premium to use this travel function.')
end
else
doPlayerSendCancel(cid, 'You don\'t have enough money.')
end
   end
 
Fixed your Script, it should work now.

Code:
local cost = 100 --------- Price of the trip
local pos = {x=428, y=514, z=6} -- position to teleport.
local posfrom = {x=428, y=513, z=6} -- position where the player needs to stand.


function onSay(cid, words, param)
	if getPlayerPremiumDays(cid) >= 1 then
		if (doPlayerRemoveMoney(cid, cost) == TRUE) then
			if getCreaturePosition(cid) == posfrom then
				doTeleportThing(cid, pos)
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
			else
				doPlayerSendCancel(cid, "You cant get teleported, please stand on the right tile.")
			end
		else
			doPlayerSendCancel(cid, "You don't have enough money.")
		end
	else
		doPlayerSendCancel(cid, "You need to be premium to use this travel function.")
	end
   	return TRUE
end

kind regards, Evil Hero
 
Just a little thing, the scripts written here will remove cash, even if the person stands on the wrong tile!
Yes that is true and its easy to fix... but thats not the big problem at all
I have watched other scripts like the jail script and from that im gonna try make finish this ;)
 
Well im back here again... thing is i cant make this script work on that way you need to stand on a special position to get teleported.
This could be kinda advanced, looked at the anni action script that actually work kinda on that way i want it, but i need help to make that!
 
You wanted it a bit optimized here is it.... NOTE please read the commends i put there so you can understand it....

Code:
----- By Dark Warrior From Ot Land ------
local cost = 100 --------- Price of the trip


function onSay(cid, words, param)
if param == "desert" then
pos = {x=428, y=514, z=6} -- position to teleport
posfrom = {x=428, y=513, z=6} -- position where the player needs to be teleported from
---- If you want to add more city just copy \/ from elseif to position where the player need to be teleported from ~~ NOTE: Not the END
elseif param == "city" then
pos = {x=428, y=514, z=6} -- position to teleport
posfrom = {x=428, y=513, z=6} -- position where the player needs to be teleported from 
end

if param == "" then
	doPlayerSendCancel(cid, 'For use this command you have to do it this way EXAMPLES: !travel"desert.... For see all the islands just say !travel"menu.')
	elseif param == "menu" then
	doPlayerSendCancel(cid, 'At this moment we only have City and Desert.')
	elseif isPremium(cid) == FALSE then
	doPlayerSendCancel(cid, 'Sorry only premium users may use this feature.')
		elseif not(getCreaturePosition(cid) == posfrom) then
		doPlayerSendCancel(cid, 'You have to stay on the right position.')
			elseif getPlayerMoney(cid) < cost then
			doPlayerSendCancel(cid, 'Sorry you need '.. cost ..' to use this feature.')
			else isPlayer(cid) == TRUE then
			doPlayerRemoveMoney(cid, cost)
				doTeleportThing(cid, pos)
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
				end
				end


Oh i didn't tested it so i'm not 100% sure if it's work but it should work!


P.S. That can be way more optimized i just did it fast...


EDIT: Almost forgot one of the most important part... remove the money XD
 
Last edited:
I get "you need to stay on the right position".
This is the problem I always get myself too, it just wont work with a position you need to stand on :(
 
I'm really sorry i didn tested it but this one work... I promise (I tested this one)
Code:
----------- By Dark Warrior From ot Land ------------
function onSay(cid, words, param)
local player = getPlayerPosition(cid)
if param == "desert" then
cost = 100
pos = {x=766, y=994, z=7} -- position to teleport
posfrom = {x=763, y=993, z=7} -- position where the player needs to be teleported from
---- If you want to add more city just copy \/ from elseif to position where the player need to be teleported from ~~ NOTE: Not the END
elseif param == "city" then
cost = 100
pos = {x=428, y=514, z=6} -- position to teleport
posfrom = {x=428, y=513, z=6} -- position where the player needs to be teleported from 
end

if param == "" then
	doPlayerSendCancel(cid, 'For use this command you have to do it this way EXAMPLES: !travel"desert.... For see all the islands just say !travel"menu.')
	elseif param == "menu" then
	doPlayerSendCancel(cid, 'At this moment we only have City and Desert.')
	elseif isPremium(cid) == FALSE then
	doPlayerSendCancel(cid, 'Sorry only premium users may use this feature.')
			elseif getPlayerMoney(cid) < cost then
			doPlayerSendCancel(cid, 'Sorry you need '.. cost ..' to use this feature.')
			elseif not(player.x == posfrom.x and player.y == posfrom.y and player.z == posfrom.z) then
			doPlayerSendCancel(cid, 'You have to stay on the right position.')
			elseif player.x == posfrom.x and player.y == posfrom.y and player.z == posfrom.z then
			doPlayerRemoveMoney(cid, cost)
				doTeleportThing(cid, pos)
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
				end
				end
 
Back
Top