OT Server Chile
¿Quieres reaccionar a este mensaje? Regístrate en el foro con unos pocos clics o inicia sesión para continuar.


Registrate y participa en nuestro foro , para que cada dia sea mas completo, y mejor para todos.
 
ÍndicePortalGaleríaBuscarÚltimas imágenesRegistrarseConectarse

 

 Santa (8.0)

Ir abajo 
AutorMensaje
Admin Nivaldo
Admin
Admin Nivaldo


Cantidad de envíos : 34
Edad : 30
Fecha de inscripción : 01/03/2008

Santa (8.0) Empty
MensajeTema: Santa (8.0)   Santa (8.0) EmptyDom Mar 02, 2008 5:28 pm

Santa.xml

Code:

<npc name="Santa" script="data/npc/scripts/santa.lua" autowalk="25" floorchange="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="160" head="0" body="94" legs="0" feet="94"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|!"/>
<parameter key="message_farewell" value="Merry Christmas." />
<parameter key="message_placedinqueue" value="Your time will come |PLAYERNAME|, ho ho ho." />
<parameter key="message_walkaway" value="Merry Christmas." />
<parameter key="message_idletimeout" value="Merry Christmas." />
<parameter key="message_walkaway" value="Merry Christmas!" />
</parameters>
</npc>





santa.lua

Code:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end

function creatureSayCallback(cid, type, msg)
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
if(npcHandler.focus ~= cid) then
return false
end

present = getPlayerStorageValue(cid, 67872)
random = math.random(1, 40)

if msgcontains(msg, 'present') then
if present == -1 then

if (random >= 1 and random <= 3) then
doPlayerAddItem(cid, 2112, 1)
setPlayerStorageValue(cid, 67872, 1)
selfSay('You were very lucky! Here is your present.')

elseif (random >= 4 and random <= 12) then
doPlayerAddItem(cid, 2675, 15)
setPlayerStorageValue(cid, 67872, 1)
selfSay('Merry Christmas! Ho Ho Ho!')

elseif (random >= 13 and random <= 20) then
doPlayerAddItem(cid, 2688, 10)
setPlayerStorageValue(cid, 67872, 1)
selfSay('Merry Christmas! Ho Ho Ho!')

elseif (random >= 21 and random <= 30) then
doPlayerAddItem(cid, 6501, 3)
setPlayerStorageValue(cid, 67872, 1)
selfSay('Merry Christmas! Ho Ho Ho!')

elseif (random >= 31 and random <= 40) then
doPlayerAddItem(cid, 2674, 5)
setPlayerStorageValue(cid, 67872, 1)
selfSay('Merry Christmas! Ho Ho Ho!')
end

else
selfSay('You already have your present, ho ho ho!')
end
end
return 1
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Volver arriba Ir abajo
https://otserverchile.activoforo.com
 
Santa (8.0)
Volver arriba 
Página 1 de 1.
 Temas similares
-
» Santa Fe RolePlay, el mejor rol universal (SA:MP 0.3x)

Permisos de este foro:No puedes responder a temas en este foro.
OT Server Chile :: Guias y Tutoriales :: Guias Npc-
Cambiar a: