 |
|
 |
|
Xarin
Nowy
Dołączył: 07 Lis 2006
Posty: 19
Przeczytał: 0 tematów
Ostrzeżeń: 0/10 Skąd: Poland
|
|
 |
|
 |
|
Wysłany: Wto 21:02, 07 Lis 2006 Temat postu: Male powitanie na servie (NPC) |
|
|
Nie jest to mój SKRYPT!
Najpierw Robimy plik XML w folderze D:\Adrian\Ots\Data\Npc oto ten skrypt nazywamy go Welcome mozemy inaczej nazwac
<?xml version="1.0"?>
<npc name="Welcome" script="data/npc/scripts/witamy.lua" access="3">
<look type="128" head="4" body="114" legs="132" feet="115"/>
</npc>
A teraz robimy plik lua w folderze D:\Adrian\Ots\Data\Npc\Script o nazwie witamy
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focIus == cid then
selfSay('O zeszty!')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Witam na pieknym serverze (twoja nazwa servera) Czy bedziesz na nim grac?')
focus = cid
talk_start = os.clock()
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'tak') then
selfSay('Ten wspanialy server zyczy ci dobrego pvp')
doPlayerRemoveMoney(cid,100)
elseif msgcontains(msg, 'nie') then
selfSay('To dziekuje panstwu')
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 5 then
if focus > 0 then
selfSay('Dowidzenia')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Dowidzenia')
focus = 0
end
end
if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,20)
if randmove == 1 then
nx = cx + 2
end
if randmove == 2 then
nx = cx - 2
end
if randmove == 3 then
ny = cy + 2
end
if randmove == 4 then
ny = cy - 2
end
if randmove == 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end
end
I dalej ustalamy wspolrzedne w pliku NPC.xml chyab wiecie jak sie to robi
Mi działa skrypt !
Post został pochwalony 0 razy
|
|