Ir para conteúdo

Posts Recomendados

Editado deixei pra lá

 

 

 

 

Bom, to com 2 problemas

 

 

quando dou Fly ou Swimming, e dou Logout o player não consegue mais logar.

da esse erro quando tenta:

[14/08/2011 03:01:58] data/creaturescripts/scripts/login.lua:onLogin
[14/08/2011 03:01:58] Description: 
[14/08/2011 03:01:58] data/creaturescripts/scripts/login.lua:152: attempt to index field '?' (a nil value)
[14/08/2011 03:01:58] stack traceback:
[14/08/2011 03:01:58] 	data/creaturescripts/scripts/login.lua:152: in function <data/creaturescripts/scripts/login.lua:6>

 

outra coisa é que eu gostaria que somente Vips pudessem dar Fly ou Swimming,

 

Meu sistema Vip usa isVip(cid) do Kydrai

 

 

Segue os sistemas

 

se alguem pude-se me indicar um sistema de Ride que não fosse por Talkaction agradeceria mto tambem!

 

login.lua

 

 

local config = {

loginMessage = getConfigValue('loginMessage'),

useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))

}

 

function onLogin(cid)

registerCreatureEvent(cid, "PlayerAttack")

doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)

doCreatureSetDropLoot(cid, false)

local gr = getPlayerGroupId(cid)

if gr == 2 then

setPlayerGroupId(cid, 1)

end

local loss = getConfigValue('deathLostPercent')

if(loss ~= nil) then

doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)

end

local accountManager = getPlayerAccountManager(cid)

if(accountManager == MANAGER_NONE) then

local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage

if(lastLogin > 0) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

str = "Sua ultima visita foi " .. os.date("%a %b %d %X %Y", lastLogin) .. "."

else

str = str .. " Divirta-se! "

end

 

doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

elseif(accountManager == MANAGER_NAMELOCK) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Olá, parece que seu personagem foi namelocked, o que você gostaria que seu novo nome?")

elseif(accountManager == MANAGER_ACCOUNT) then

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Olá, escreva 'account' para administrar sua conta se quiser sair digite 'cancel'.")

else

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "OI, escreva 'account' para criar uma conta ou escreva 'recover' para recuperar um conta.")

end

 

if(not isPlayerGhost(cid)) then

doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)

end

local flys = {

['Moltres'] = {229, 2300},

['Articuno'] = {230, 2100},

['Zapdos'] = {224, 2600},

['Mew'] = {232, 2200},

['Mewtwo'] = {233, 2200},

['Dragonite'] = {221, 1300},

['Pidgeot'] = {222, 900},

['Fearow'] = {226, 800},

['Aerodactyl'] = {227, 1100},

['Charizard'] = {216, 1000},

['Porygon'] = {316, 600},

['Shiny Charizard'] = {295, 2000},

}

 

local rides = {

["Tauros"] = {128, 780, 400}, -- tauros

["Ninetales"] = {129, 800, 375}, -- kyuubi

["Rapidash"] = {130, 800, 395}, -- rapid

["Ponyta"] = {131, 410, 500}, -- ponyta

["Rhyhorn"] = {132, 400, 510}, -- rhyhorn

["Arcanine"] = {12, 900, 390}, -- arcan

["Shiny Arcanine"] = {492, 1000, 360}, -- shiny arca

["Shiny Venusaur"] = {494, 420, 420}, -- shiny vneu

["Crystal Onix"] = {293, 480, 430}, -- cristal onix

["Onix"] = {126, 450, 450}, -- onix

["Venusaur"] = {134, 390, 450}, -- venu

["Dodrio"] = {133, 750, 380}, -- dodrio

["Doduo"] = {135, 420, 500}, -- doduo

}

 

local surf = {

["Poliwag"] = {lookType=278, speed = 320},

["Poliwhirl"] = {lookType=137, speed = 480},

["Seaking"] = {lookType=269, speed = 520},

["Dewgong"] = {lookType=183, speed = 700},

["Blastoise"] = {lookType=184, speed = 850},

["Tentacruel"] = {lookType=185, speed = 750},

["Lapras"] = {lookType=186, speed = 960},

["Gyarados"] = {lookType=187, speed = 1050},

["Omastar"] = {lookType=188, speed = 680},

["Kabutops"] = {lookType=189, speed = 840},

["Poliwrath"] = {lookType=190, speed = 680},

["Vaporeon"] = {lookType=191, speed = 800},

["Staryu"] = {lookType=266, speed = 385},

["Starmie"] = {lookType=267, speed = 685},

["Goldeen"] = {lookType=268, speed = 355},

["Seadra"] = {lookType=270, speed = 655},

["Golduck"] = {lookType=271, speed = 760},

["Squirtle"] = {lookType=273, speed = 365},

["Wartortle"] = {lookType=275, speed = 605},

["Tentacool"] = {lookType=277, speed = 340},

["Snorlax"] = {lookType=300, speed = 500},

}

 

registerCreatureEvent(cid, "GuildMotd")

registerCreatureEvent(cid, "Mail")

registerCreatureEvent(cid, "PlayerPokeDeath")

registerCreatureEvent(cid, "onPrepareDeath")

registerCreatureEvent(cid, "LogoutPoke")

registerCreatureEvent(cid, "spQuest")

registerCreatureEvent(cid, "lSpQuest")

registerCreatureEvent(cid, "WildAttack")

registerCreatureEvent(cid, "Idle")

registerCreatureEvent(cid, "Tele")

registerCreatureEvent(cid, "Exp")

registerCreatureEvent(cid, "Alook")

registerCreatureEvent(cid, "Idle")

if(config.useFragHandler) then

registerCreatureEvent(cid, "SkullCheck")

registerCreatureEvent(cid, "Sm")

registerCreatureEvent(cid, "6")

end

 

 

if getPlayerStorageValue(cid, 61207) >= 1 then

setPlayerStorageValue(cid, 61207, 0)

if getPlayerSlotItem(cid, 8).itemid == 2223 or getPlayerSlotItem(cid, 8).itemid == 2221 then

doTransformItem(getPlayerSlotItem(cid, 8).uid, getPlayerSlotItem(cid, 8).itemid-1)

end

local item = getPlayerSlotItem(cid, 8)

doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]")

end

if getPlayerItemCount(cid, pokeout) >= 1 and getPlayerStorageValue(cid, 61207) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then

local item = getPlayerItemById(cid, TRUE, pokeout)

doTransformItem(item.uid, pokein)

doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]")

end

if getPlayerItemCount(cid, ultrapokeout) >= 1 and getPlayerStorageValue(cid, 61207) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then

local item = getPlayerItemById(cid, TRUE, ultrapokeout)

doTransformItem(item.uid, ultrapokein)

doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]")

end

if getPlayerItemCount(cid, greatout) >= 1 and getPlayerStorageValue(cid, 61207) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then

local item = getPlayerItemById(cid, TRUE, greatout)

doTransformItem(item.uid, greatin)

doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]")

end

if getPlayerItemCount(cid, superout) >= 1 and getPlayerStorageValue(cid, 61207) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then

local item = getPlayerItemById(cid, TRUE, superout)

doTransformItem(item.uid, superin)

doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]")

end

if getPlayerItemCount(cid, saffariout) >= 1 and getPlayerStorageValue(cid, 61207) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then

local item = getPlayerItemById(cid, TRUE, saffariout)

doTransformItem(item.uid, saffariin)

doItemSetAttribute(item.uid, "poke", getItemAttribute(item.uid, "poke") .. " HP = ["..getPlayerStorageValue(cid, 61205).."/"..getPlayerStorageValue(cid, 61206).."]")

end

doChangeSpeed(cid, -(getCreatureSpeed(cid)))

if getPlayerStorageValue(cid, 17000) >= 1 then

item = getPlayerSlotItem(cid, 8)

poke = getItemAttribute(item.uid, "poke"):match("This is (.-)'s pokeball.")

doChangeSpeed(cid, flys[poke][2])

registerCreatureEvent(cid, "Flying")

doRemoveCondition(cid, CONDITION_OUTFIT)

doSetCreatureOutfit(cid, {lookType = flys[poke][1], lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)

elseif getPlayerStorageValue(cid, 63215) >= 1 then

item = getPlayerSlotItem(cid, 8)

poke = getItemAttribute(item.uid, "poke"):match("This is (.-)'s pokeball.")

doSetCreatureOutfit(cid, surf[poke], -1)

doChangeSpeed(cid, surf[poke].speed)

elseif getPlayerStorageValue(cid, 17001) >= 1 then

item = getPlayerSlotItem(cid, 8)

poke = getItemAttribute(item.uid, "poke"):match("This is (.-)'s pokeball.")

doChangeSpeed(cid, rides[poke][2])

doRemoveCondition(cid, CONDITION_OUTFIT)

doSetCreatureOutfit(cid, {lookType = rides[poke][1], lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)

else

if getPlayerGroupId(cid) >= 2 and getPlayerGroupId(cid) <= 7 then

doChangeSpeed(cid, 400*getPlayerGroupId(cid))

else

doChangeSpeed(cid, 250)

end

end

if getPlayerVocation(cid) == 0 then

doPlayerSetVocation(cid, 1)

setCreatureMaxMana(cid, 6)

doPlayerAddSoul(cid, -getPlayerSoul(cid))

setPlayerStorageValue(cid, 19898, 0)

end

if getCreatureOutfit(cid).lookType == 128 then

outfit = {lookType = 159}

doCreatureChangeOutfit(cid, outfit)

elseif getCreatureOutfit(cid).lookType == 136 then

outfit = {lookType = 160}

doCreatureChangeOutfit(cid, outfit)

end

registerCreatureEvent(cid, "ReportBug")

registerCreatureEvent(cid, "AdvanceSave")

registerCreatureEvent(cid, "NPC")

return true

end

 

 

 

 

fly.lua

 

local del = {'460', '1022', '1023'}

local updown = {'1', '3'}

 

function onStepIn(cid, item, frompos, item2, topos)

if getPlayerStorageValue(cid, 17000) <= 0 then

doTeleportThing(cid, topos, false)

doRemoveItem(getTileThingByPos(frompos).uid, 1)

if isPlayer(cid) then

doPlayerSendCancel(cid, "You can't fly.")

end

return true

end

if getPlayerStorageValue(cid, 17000) >= 1 then

if topos.z == frompos.z then

if getCreatureOutfit(cid).lookType == 316 then

effect = 136

else

effect = 2

end

doSendMagicEffect(topos, effect)

end

end

for x=-1,1 do

for y=-1,1 do

posa = {x=topos.x+x,y=topos.y+y,z=topos.z}

if isInArray(del, getTileThingByPos(posa).itemid) then

doRemoveItem(getTileThingByPos(posa).uid, 1)

end

end

end

for x=-1,1 do

for y=-1,1 do

pose = {x=frompos.x+x,y=frompos.y+y,z=frompos.z}

if getTileThingByPos(pose).itemid == 0 then

doCombatAreaHealth(cid, 0, pose, 0, 0, 0, CONST_ME_NONE)

doCreateItem(460, 1, pose)

end

end

end

doCombatAreaHealth(cid, 0, topos, 0, 0, 0, CONST_ME_NONE)

doCreateItem(460, 1, frompos)

if topos.z > frompos.z then

doCreateItem(1023, 1, frompos)

doTransformItem(getTileThingByPos(frompos).uid, 1023)

elseif topos.z < frompos.z then

doCreateItem(1022, 1, frompos)

doTransformItem(getTileThingByPos(frompos).uid, 1022)

end

return true

end

 

 

 

swimming.lua

 

local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

 

local BORDERS = {

[7943] = {x = 0, y = -2, back = SOUTH},

[7944] = {x = -2, y = 0, back = EAST},

[7945] = {x = 0, y = 2, back = NORTH},

[7946] = {x = 2, y = 0, back = WEST},

[7947] = {x = 2, y = 1, back = WEST},

[7948] = {x = -2, y = 1, back = NORTH},

[7949] = {x = 2, y = -1, back = WEST},

[7950] = {x = -2, y = -1, back = EAST},

[7951] = {x = 2, y = 2, back = WEST},

[7952] = {x = -2, y = 2, back = NORTH},

[7953] = {x = 2, y = -2, back = WEST},

[7954] = {x = -2, y = -2, back = SOUTH}

}

 

BORDERS[4828] = BORDERS[7943]

BORDERS[4829] = BORDERS[7946]

BORDERS[4830] = BORDERS[7945]

BORDERS[4831] = BORDERS[7944]

 

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

if(not isPlayer(cid)) then

return true

end

 

local border = BORDERS[item.itemid]

if(not border) then

return false

end

 

local pos, newPos = getCreaturePosition(cid), {}

newPos = pos

newPos.x = pos.x + border.x

newPos.y = pos.y + border.y

 

if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then

doMoveCreature(cid, border.back)

doRemoveCondition(cid, CONDITION_OUTFIT)

else

if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then

return false

end

 

local tmp = getCreaturePosition(cid)

doTeleportThing(cid, newPos)

 

if(not isPlayerGhost(cid)) then

doSendMagicEffect(tmp, CONST_ME_POFF)

doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)

end

 

doRemoveConditions(cid, true)

doSetCreatureOutfit(cid, outfit, -1)

end

 

return true

end

 

 

 

 

Editado por TeruN
Link para o comentário
https://xtibia.com/forum/topic/164929-2-problemas-poke-fly-e-swimming/
Compartilhar em outros sites

×
×
  • Criar Novo...