• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Palomino & Appaloosa NPC TFS 0.3.7 Rent Horse Npc

Blysco

New Member
Joined
Oct 12, 2013
Messages
163
Reaction score
2
Hey, i have both Npcs but when i place one of them in my Map my Server just crash.
No Error nothing but the Server just crash while he is loading the Map & Spawns
and when i delete the Npcs on the Map the Server works fine.

Cann someone give a link for Palomino & Appaloosa Npc+Script ?
Anyway i need a corpse for dead horses.

Please someone upload.

This would be nice !
 
I just took Id : 8312 as the corpse and renamed to dead Horse.

Sometimes there is a foreign launglage.
I cannt translate i dont know which foreign launlage it is :/

Please help...

Code:
<?xml version="1.0"?>
<npc name="Palomino" script="data/npc/scripts/aluguelmounts.lua" walkinterval="50000" floorchange="0">
<health now="1000" max="1000"/>
<look type="128" head="116" body="39" legs="48" feet="97" addons="2"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. You want to {rent} a {mount}?"/>
</parameters>
</npc>

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
    return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local msg = string.lower(msg)
if isInArray({'rent', 'mount', 'horse'}, msg) then
    npcHandler:say("You can rent a {rented horse}!", cid)
    talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
    if rent_mounts[msg] then
        if rent_mounts[msg].premium == true and not isPremium(cid) then
            npcHandler:say('You need to be premium to rent this mount.', cid) return true
        elseif getPlayerLevel(cid) < rent_mounts[msg].level then
            npcHandler:say('You need level ' .. rent_mounts[msg].level .. ' or more to rent this mount.', cid) return true
        elseif getPlayerStorageValue(cid, rent_mounts[msg].storage) >= os.time() then
            npcHandler:say('you already have rented this mount!', cid) return true
        end
        name,price,stor,days,mountid = msg,rent_mounts[msg].price,rent_mounts[msg].storage,rent_mounts[msg].days,rent_mounts[msg].mountid
        npcHandler:say('You want to rent the mount '..name..' for '..days..' day'..(days > 1 and 's' or '')..' the price '..price..' gps? {yes}', cid)
        talkState[talkUser] = 2
    else
        npcHandler:say('Sorry, I do not sell this mount.', cid)
    end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
    if doPlayerRemoveMoney(cid, price) then
        doPlayerAddMount(cid, mountid)
        setPlayerStorageValue(cid, stor, os.time()+days*86400)
        npcHandler:say('Here is your mount '..name..', it will last until '..os.date("%d %B %Y %X", getPlayerStorageValue(cid,stor))..'.', cid)
    else
        npcHandler:say('you do not have enough money to rent the mount!', cid)
        talkState[talkUser] = 0
    end
elseif msg == "no" then
    selfSay("Then not", cid)
    talkState[talkUser] = 0
    npcHandler:releaseFocus(cid)
end
local travelNode = keywordHandler:addKeyword({'palomino'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you seek a passage to Palomino for 125 gold?'})
    travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 125, destination = {x=32449, y=32226, z=7} })
    travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
return TRUE
end  
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


Code:
domodlib('aluguel_func')
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
local msg = string.lower(msg)
if isInArray({'aluguel','alugar', 'rent', 'mounts', 'mount'}, msg) then
npcHandler:say("Você pode alugar {war horse}, {gray horse}, {dragonling}, {gnarlhound}, {magma crawler}, {ironblight}!", cid)
talkState[talkUser] = 1
elseif talkState[talkUser] == 1 then
if Aluguel_mounts[msg] then
if Aluguel_mounts[msg].premium == true and not isPremium(cid)  then
npcHandler:say('Você precisa ser premium para alugar essa montaria.', cid) return true
elseif getPlayerLevel(cid) < Aluguel_mounts[msg].level then
npcHandler:say('você precisa ter level ' .. Aluguel_mounts[msg].level .. ' ou mais para alugar essa montaria.', cid) return true
elseif getPlayerStorageValue(cid, Aluguel_mounts[msg].storage) >= os.time() then
npcHandler:say('você já alugou essa montaria!', cid) return true
end
name,price,stor,days,mountid = msg,Aluguel_mounts[msg].price,Aluguel_mounts[msg].storage,Aluguel_mounts[msg].days,Aluguel_mounts[msg].mountid
npcHandler:say('Você quer alugar a montaria '..name..' por '..days..' dia'..(days > 1 and 's' or '')..' no preço de '..price..' gps? {yes}', cid)
talkState[talkUser] = 2
else
npcHandler:say('Desculpe, eu não alugo essa montaria.', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if doPlayerRemoveMoney(cid, price)  then
doPlayerAddMount(cid, mountid)
setPlayerStorageValue(cid, stor, os.time()+days*86400)
npcHandler:say('Aqui está sua montaria '..name..', ela irá durar até '..os.date("%d %B %Y %X", getPlayerStorageValue(cid,stor))..'.', cid)
else
npcHandler:say('você não tem dinheiro suficiente para alugar a montaria!', cid)
talkState[talkUser] = 0
end
elseif msg == "no" then
selfSay("Then not", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top