What's new

Talkactions Auto Walk

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Opis: Po wpisaniu komendy !walk posta? idzie a? nie napotka przeszkody po drodze lub nie wpiszemy drugi raz komendy. Posta? sterujemy za pomoc? Ctrl + strza?ki.
Autor: Noninhouh

talkactions.xml
[xml]<talkaction words="!walk" event="script" value="walk.lua"/>[/xml]
walk.lua
[lua]function doStartAutoWalk(cid)
if not isCreature(cid) or getPlayerStorageValue(cid, 10000) == -1 then return end

local toPosition = getCreatureLookPosition(cid)
toPosition.stackpos = 0
local tileId = getTileThingByPos(toPosition).itemid

if tileId == 0 or doTileQueryAdd(cid, toPosition) ~= RETURNVALUE_NOERROR then
setPlayerStorageValue(cid, 10000, -1)
return
end

doMoveCreature(cid, getCreatureLookDir(cid))
addEvent(doStartAutoWalk, (1000 * getItemInfo(tileId).speed) / getCreatureSpeed(cid), cid)
end

function onSay(cid, words, param, channel)
if getPlayerStorageValue(cid, 10000) ~= -1 then
setPlayerStorageValue(cid, 10000, -1)
else
setPlayerStorageValue(cid, 10000, 1)
doStartAutoWalk(cid)
end
return true
end[/lua]

creaturescripts.xml
[xml]<event type="logout" name="PlayerLogout" event="script" value="logout.lua"/>[/xml]
logout.lua
[lua]function onLogout(cid)
if getPlayerStorageValue(cid, 10000) ~= -1 then
setPlayerStorageValue(cid, 10000, -1)
end
return true
end[/lua]
 
Top