What's new

Talkactions Waypoints (save/tele)

Status
Not open for further replies.

Ukzz

User
Joined
Jun 2, 2008
Messages
38
Reaction score
2
Daje mam moje waypointsy ktore stworzylem na szybko do testowania roznych skryptow na mapie. Bazuja one na samych plikach wiec nie zapychaja zbednie storage (zreszta storage do takiego rozwiazania to smieszny pomysl) a dzialaja zapewne na kazdym z tfsow. W data wystarczy stworzyc folder waypoints i powinno chodzic.

waypoint.lua
[LUA]
function onSay(cid, words, param, channel)
local params = string.explode(param, ",")
if not params[1] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified [save/tele].")
return true
end

if (params[1] == 'save') then
if params[2] then
file = io.open("data/waypoints/"..params[2], "w+")
file:write((getPlayerPosition(cid).x).."|"..(getPlayerPosition(cid).y).."|"..(getPlayerPosition(cid).z))
file:close()
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Waypoint saved.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No waypoint name specified.")
end
elseif (params[1] == 'tele') then
if params[2] then
file = io.open("data/waypoints/"..params[2], "r")
if (file ~= nil) then
local buffer = string.explode(file:read(), "|")
local temp = {x = buffer[1], y = buffer[2], z = buffer[3]}
doTeleportThing(cid, temp)
doSendMagicEffect(temp, CONST_ME_POFF)
doPlayerSendCancel(cid, "Teleported to waypoint named " .. params[2] .. ".")
doCreatureSay(cid, "Teleported to waypoint named " .. params[2] .. ".", TALKTYPE_ORANGE_1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is no waypoint named " .. params[2] .. ".")
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "No waypoint name specified.")
end
end

return true
end
[/LUA]

talkactions.xml
[XML]
<talkaction log="yes" words="/wpt;!wpt;/wp;!wp" access="5" event="script" value="waypoint.lua"/>
[/XML]
 

sawex

Advanced User
Joined
Aug 17, 2008
Messages
421
Reaction score
23
Odp: Waypoints (save/tele)

nie zapychaja zbednie storage --- A po co jest storage jak szkoda go zapycha?? o_O
Ale fakt faktem pozycje niewygodnie si? zapisuje.
 

Govern

Advanced User
Joined
Jun 6, 2011
Messages
308
Reaction score
35
Odp: Waypoints (save/tele)

Storage jest w?a?nie po to by z niego korzysta?...

Z powodu braku zainteresowania temat zamykam. Je?eli zajdzie potrzeba do ponownego otwarcia pro?ba o info na PW.
 
Last edited:
Status
Not open for further replies.
Top