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]
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]