• 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 Login.lua help!

kite28

Member
Joined
May 15, 2012
Messages
69
Reaction score
5
Hi, I have a problem with one of the ots I'm testing because I'm looking for some calm, good engine without bugs etc. one is cool but jumps out on it here is the console after creating a character you can not see her, he gets nothing or any advice?
Console
[30/05/2018 14:34:43] [Error - CreatureScript Interface]
[30/05/2018 14:34:43] data/creaturescripts/scripts/player/login.lua:eek:nLogin
[30/05/2018 14:34:43] Description:
[30/05/2018 14:34:43] (luaDoItemSetAttribute) Item not found


Login.lua
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function BetaItem(cid)
if getPlayerStorageValue(cid, storages.betaStorage) == -1 then
addPokeToPlayer(cid, "Squirtle", 0, nil, "poke", true)
addPokeToPlayer(cid, "Charmander", 0, nil, "poke", true)
addPokeToPlayer(cid, "Bulbasaur", 0, nil, "poke", true)
setPlayerStorageValue(cid, storages.betaStorage, 1)
doSendMsg(cid, "Vocę ganhou um Pack Inicial.")
end
end

function AutoLootinit(cid)
if getPlayerStorageValue (cid, storages.AutoLootCollectAll) == -1 then
setPlayerStorageValue(cid, storages.AutoLootCollectAll, "no")
end
return true
end

function onLogin(cid)

if getCreatureName(cid) == "[ADM] One" then
setPlayerGroupId(cid, 15)
doRegainSpeed(cid)
doGetPlayersOnToADM(cid)
else
doSendUpdatesOnlineToADM()
end


doPlayerSetVocation(cid, 10)
doSendPlayerExtendedOpcode(cid, 126, "nao")
doResetPlayerTVSystem(cid)

if not isGod(cid) then
setPlayerGroupId(cid, 1)
doRegainSpeed(cid)
end

if isGod(cid) then -- Resetar diarias se for God
setPlayerStorageValue(cid, storages.miniQuests.storDayTask1, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask2, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask3, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask4, -1)
end

if getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 10 then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
else
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, (getPlayerLevel(cid) >= 200 and 100 or math.floor(getPlayerLevel(cid)/2)) )
end

doRegainSpeed(cid)

--////// storages \\\\\\--
doEreaseDuel(cid)
setPlayerStorageValue(cid, 500, -1)
setPlayerStorageValue(cid, 8085, 0)
--// duel
setPlayerStorageValue(cid, storages.requestCountPlayer, 0)
setPlayerStorageValue(cid, storages.requestCountPokemon, 0)
setPlayerStorageValue(cid, storages.requestedPlayer, 0)
--// duel
--////// storages \\\\\\--

--////// Eventos \\\\\\--
registerCreatureEvent(cid, "ShowPokedex")
registerCreatureEvent(cid, "ClosePokedex")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "WildAttack")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
--Adicionados \/
registerCreatureEvent(cid, "PlayerLogout")
registerCreatureEvent(cid, "LookSystem")
registerCreatureEvent(cid, "Opcode")
registerCreatureEvent(cid, "EmeraldShop")
registerCreatureEvent(cid, "PokeStats")
registerCreatureEvent(cid, "PokeWalk")
registerCreatureEvent(cid, "PokeSleep")
registerCreatureEvent(cid, "MoveItem")
registerCreatureEvent(cid, "task_count")
registerCreatureEvent(cid, "UpLevel")
registerCreatureEvent(cid, "BlockWords")
--registerCreatureEvent(cid, "PartySystem")
registerCreatureEvent(cid, "Target")
registerCreatureEvent(cid, "GeneralConfiguration")
registerCreatureEvent(cid, "EffectOnAdvance")
registerCreatureEvent(cid, "TradeRequest")
registerCreatureEvent(cid, "TradeAccpet")
registerCreatureEvent(cid, "KillTask")
--////// Eventos \\\\\\--

if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end

local legs = getPlayerSlotItem(cid, CONST_SLOT_LEGS)
local ball = getPlayerSlotItem(cid, 8)

if getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= 0 then
doItemEraseAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "healthChanged")
end
--doOTCSendPokemonHealth(cid)
--doClearPokemonStatus(cid)

if isRiderOrFlyOrSurf(cid) and ball.uid ~= 0 then
local pokeName = getItemAttribute(ball.uid, "poke")

if isInArray({"ditto", "shiny ditto"}, pokeName:lower()) then
pokeName = getItemAttribute(ball.uid, "copyName")
end

local outfit = getPokemonOutfitToSkill(pokeName)
local speed = getPokemonSpeedToSkill(pokeName)
doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)

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

if isRider(cid) then
setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
elseif isFly(cid) then
setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
if not hasSqm(getThingPos(cid)) then
-- doCreateItem(460, 1, getThingPos(cid))
end
elseif isSurf(cid) then
setPlayerStorageValue(cid, orderTalks["surf"].storage, 1) -- rever o markedPos
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
end
doTeleportThing(cid, getMarkedSpawnPos(cid))
setPokemonGhost(cid)
end

setPlayerStorageValue(cid, storages.gobackDelay, -1)
setPlayerStorageValue(cid, storages.pokedexDelay, -1)
setPlayerStorageValue(cid, 154585, -1)
doAddFirstItemsToPlayer(cid)
BetaItem(cid)
AutoLootinit(cid)
--doAddShoppingItem(cid)

-- otclient life
doSendLifePokeToOTC(cid)
-- otclient life

return true
end
function doAddFirstItemsToPlayer(cid)
local config = {
storage = 30001,
items = {1988, 1987, 2382, 2120, 2550, 2580, 7385, 2395}
-- 7385 (pokeinfo)
-- 2395 (portfoil) ok
-- 2382 (pokedex) ok
-- 2550 (order) ok
-- 1987 (bag) ok
-- 1988 (badge case) ok
-- 2120 (rope) ok
-- 2580 (fishing rod) ok
}
setPlayerCap(cid, 7)
if getCreatureName(cid) == "Account Manager" then
doSetCreatureOutfit(cid, {lookType = 655}, -1)
return true
end
if getPlayerStorageValue(cid, storages.BugFishing) ~= -1 then return true end

if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid > 0 then
return true
end

for _, id in ipairs(config.items) do
doPlayerAddItem(cid, id, 1)
end
local bag = getPlayerItemById(cid, false, 1988).uid
doAddContainerItem(bag, 12267, 1)
doAddContainerItem(bag, 12266, 1)
doAddContainerItem(bag, 12264, 1)
doAddContainerItem(bag, 12265, 1)
doAddContainerItem(bag, 12263, 1)
doAddContainerItem(bag, 12262, 1)
doAddContainerItem(bag, 12261, 1)
doAddContainerItem(bag, 12260, 1)
setPlayerStorageValue(cid, duelTable.wins, 0)
setPlayerStorageValue(cid, duelTable.loses, 0)
local pokeBag = getPlayerItemById(cid, false, 1987).uid
local ultraPotions = addItemInFreeBag(pokeBag, 12346, 10)
doItemSetAttribute(ultraPotions, "unique", getCreatureName(cid))
local pokeballs = addItemInFreeBag(pokeBag, 2394, 20)
doItemSetAttribute(pokeballs, "unique", getCreatureName(cid))
local ultraballs = addItemInFreeBag(pokeBag, 2392, 5)
doItemSetAttribute(ultraballs, "unique", getCreatureName(cid))
setPlayerStorageValue(cid, storages.BugFishing, 1)
doTeleportThing(cid, getTownTemplePosition(1), false)

---Corrigindo vida caso o playe relogue ---

local health = 10000 -- vida que voce colocou no robo.lua
if getPlayerStorageValue(cid, 92001) >= 1 then
setPlayerStorageValue(cid, 92001, 0)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-health)-- linha adicionada by crypter
end


return true
end

local itensShopping = {
[1] = {{2394, 100}, {12344, 25}, {12286, 2}},
[2] = {{2391, 200}, {2393, 100}, {2392, 100}},
[3] = {{12832, 1}},
[4] = {{12286, 1}},
[5] = {premiumDays = 30}
}

function doAddShoppingItem(cid)
local allItems = {}
local compra = 0
local msg = ""
local result = db.getResult("SELECT itemID, compraID FROM playercompras WHERE playerID = '" .. getPlayerGUID(cid) .. "' AND entregue = 0")
if result:getID() ~= -1 then
compra = result:getDataInt("compraID")
allItems[#allItems+1] = result:getDataInt("itemID")
db.executeQuery("UPDATE playercompras SET entregue = 13 WHERE compraID = ".. compra ..";")
while(result:next()) do
allItems[#allItems+1] = result:getDataInt("itemID")
compra = result:getDataInt("compraID")
db.executeQuery("UPDATE playercompras SET entregue = 13 WHERE compraID = ".. compra ..";")
end
end

if #allItems > 0 then
for i = 1, #allItems do
if allItems == 5 then
doPlayerAddPremiumDays(cid, itensShopping[allItems].premiumDays)
msg = "Seu pacote de '30 premium days' foi adicionado a sua conta com sucesso!"
doSendMsg(cid, msg)
else
local bag = doCreateItemEx(12694) -- cubone bag de gratis
for j = 1, #itensShopping[allItems] do
doAddContainerItem(bag, itensShopping[allItems][j][1], itensShopping[allItems][j][2])
end

doPlayerSendMailByName(getCreatureName(cid), bag, 1)
msg = "Os itens que foram comprados pelo shopping foram enviados para seu cp."
doSendMsg(cid, msg)
end
end
end
end

function addSkillsToDB(cid)
local str1 = "INSERT INTO player_skills (player_id, skillid, value, count) VALUES (" .. getPlayerGUID(cid) .. ", 5, 5, 0);"
local str2 = "INSERT INTO player_skills (player_id, skillid, value, count) VALUES (" .. getPlayerGUID(cid) .. ", 6, 5, 0);"
db.executeQuery(str1)
db.executeQuery(str2)
end
 
I can't really fix anything if you can't show me the code behind the acc maker. My guess would be that it performs INSERT statement on your database with looktype that does not exist which means when you login you have no outfit. But to be sure, I would go into database -> players -> character you created in video (tester) and change it's looktype to the one your GM/GOD account has
He is using the in engine account maker, its located inside the source code so there is no lua file for it.

Seems like the new characters use an outfit that has been removed, you can fix this by force change outfit while loging for the first time and then assign an storage id to make sure it wont force your outfit to change.
This should be inside the login.lua and since the login.lua has already been changed then that part might had been removed.

The problem is that if you create an account in the account manager, the account is created and the character has no appearance and does not receive startup items.
thats because its removed inside the login.lua file

edit:
adding this to login.lua, might solve the problem whit outfit
Lua:
local lastLogin, str = getPlayerLastLoginSaved(cid), "Welcome Online!"
if(lastLogin > 0) then
    str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
    doCreatureChangeOutfit(cid, 520)
    str = str .. " Please choose your outfit."
    doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
 
Last edited:
He is using the in engine account maker, its located inside the source code so there is no lua file for it.

Seems like the new characters use an outfit that has been removed, you can fix this by force change outfit while loging for the first time and then assign an storage id to make sure it wont force your outfit to change.
This should be inside the login.lua and since the login.lua has already been changed then that part might had been removed.


thats because its removed inside the login.lua file

edit:
adding this to login.lua, might solve the problem whit outfit
Lua:
local lastLogin = getPlayerLastLoginSaved(cid)
if(lastLogin > 0) then
    str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
    doCreatureChangeOutfit(cid, 520)
    str = "Please choose your outfit."
    doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

That's what I thought haha. Alternatively, they can implement their own account maker or even a website.
 
That's what I thought haha. Alternatively, they can implement their own account maker or even a website.
Thats is correct, but during testing thats not really necessary. And even when the server is live to the public its fine to use the ingame account maker. :)

But you should never mix the 2 of them, i mean if you plan on using a website then you should setup that before you launch the server to the public.
That way you are sure all players used the same method when thay got created.
 
Last edited:
[31/05/2018 17:50:33] [Error - CreatureScript Interface]
[31/05/2018 17:50:33] data/creaturescripts/scripts/player/login.lua
[31/05/2018 17:50:33] Description:
[31/05/2018 17:50:33] (internalGetPlayerInfo) Player not found when requesting player info #36

[31/05/2018 17:50:33] [Error - CreatureScript Interface]
[31/05/2018 17:50:33] data/creaturescripts/scripts/player/login.lua
[31/05/2018 17:50:33] Description:
[31/05/2018 17:50:33] data/creaturescripts/scripts/player/login.lua:225: attempt to compare number with boolean
[31/05/2018 17:50:33] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/player/login.lua)

where should I paste it? Because it still does not work ... If someone is so nice, give me GG, Skype, or discord, TS to fix it :)
 
where should I paste it? Because it still does not work ... If someone is so nice, give me GG, Skype, or discord, TS to fix it :)
What TFS version is the server based on?

You should be able to put that anywhere in the login.lua file aslong your server support the functions, those functions all work for 0.x TFS servers
 
[31/05/2018 19:04:28] The Forgotten Server, version 0.3.6 (Crying Damson)

local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function BetaItem(cid)
if getPlayerStorageValue(cid, storages.betaStorage) == -1 then
addPokeToPlayer(cid, "Squirtle", 0, nil, "poke", true)
addPokeToPlayer(cid, "Charmander", 0, nil, "poke", true)
addPokeToPlayer(cid, "Bulbasaur", 0, nil, "poke", true)
setPlayerStorageValue(cid, storages.betaStorage, 1)
doSendMsg(cid, "Vocę ganhou um Pack Inicial.")
end
end

function AutoLootinit(cid)
if getPlayerStorageValue (cid, storages.AutoLootCollectAll) == -1 then
setPlayerStorageValue(cid, storages.AutoLootCollectAll, "no")
end
return true
end

function onLogin(cid)

if getCreatureName(cid) == "[ADM] One" then
setPlayerGroupId(cid, 15)
doRegainSpeed(cid)
doGetPlayersOnToADM(cid)
else
doSendUpdatesOnlineToADM()
end


doPlayerSetVocation(cid, 10)
doSendPlayerExtendedOpcode(cid, 126, "nao")
doResetPlayerTVSystem(cid)

if not isGod(cid) then
setPlayerGroupId(cid, 1)
doRegainSpeed(cid)
end

if isGod(cid) then -- Resetar diarias se for God
setPlayerStorageValue(cid, storages.miniQuests.storDayTask1, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask2, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask3, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask4, -1)
end

if getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 10 then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
else
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, (getPlayerLevel(cid) >= 200 and 100 or math.floor(getPlayerLevel(cid)/2)) )
end

doRegainSpeed(cid)
--////// storages \\\\\\--
doEreaseDuel(cid)
setPlayerStorageValue(cid, 500, -1)
setPlayerStorageValue(cid, 8085, 0)
--// duel
setPlayerStorageValue(cid, storages.requestCountPlayer, 0)
setPlayerStorageValue(cid, storages.requestCountPokemon, 0)
setPlayerStorageValue(cid, storages.requestedPlayer, 0)
--// duel
--////// storages \\\\\\--
--////// Eventos \\\\\\--
registerCreatureEvent(cid, "ShowPokedex")
registerCreatureEvent(cid, "ClosePokedex")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "WildAttack")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
--Adicionados \/
registerCreatureEvent(cid, "PlayerLogout")
registerCreatureEvent(cid, "LookSystem")
registerCreatureEvent(cid, "Opcode")
registerCreatureEvent(cid, "EmeraldShop")
registerCreatureEvent(cid, "PokeStats")
registerCreatureEvent(cid, "PokeWalk")
registerCreatureEvent(cid, "PokeSleep")
registerCreatureEvent(cid, "MoveItem")
registerCreatureEvent(cid, "task_count")
registerCreatureEvent(cid, "UpLevel")
registerCreatureEvent(cid, "BlockWords")
--registerCreatureEvent(cid, "PartySystem")
registerCreatureEvent(cid, "Target")
registerCreatureEvent(cid, "GeneralConfiguration")
registerCreatureEvent(cid, "EffectOnAdvance")
registerCreatureEvent(cid, "TradeRequest")
registerCreatureEvent(cid, "TradeAccpet")
registerCreatureEvent(cid, "KillTask")
--////// Eventos \\\\\\--
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end

local legs = getPlayerSlotItem(cid, CONST_SLOT_LEGS)
local ball = getPlayerSlotItem(cid, 8)

if getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= 0 then
doItemEraseAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "healthChanged")
end
--doOTCSendPokemonHealth(cid)
--doClearPokemonStatus(cid)

if isRiderOrFlyOrSurf(cid) and ball.uid ~= 0 then
local pokeName = getItemAttribute(ball.uid, "poke")

if isInArray({"ditto", "shiny ditto"}, pokeName:lower()) then
pokeName = getItemAttribute(ball.uid, "copyName")
end

local outfit = getPokemonOutfitToSkill(pokeName)
local speed = getPokemonSpeedToSkill(pokeName)
doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)

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

if isRider(cid) then
setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
elseif isFly(cid) then
setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
if not hasSqm(getThingPos(cid)) then
-- doCreateItem(460, 1, getThingPos(cid))
end
elseif isSurf(cid) then
setPlayerStorageValue(cid, orderTalks["surf"].storage, 1) -- rever o markedPos
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
end
doTeleportThing(cid, getMarkedSpawnPos(cid))
setPokemonGhost(cid)
end

setPlayerStorageValue(cid, storages.gobackDelay, -1)
setPlayerStorageValue(cid, storages.pokedexDelay, -1)
setPlayerStorageValue(cid, 154585, -1)
doAddFirstItemsToPlayer(cid)
BetaItem(cid)
AutoLootinit(cid)
--doAddShoppingItem(cid)

-- otclient life
doSendLifePokeToOTC(cid)
-- otclient life

return true
end
function doAddFirstItemsToPlayer(cid)
local config = {
storage = 30001,
items = {1988, 1987, 2382, 2120, 2550, 2580, 7385, 2395}
-- 7385 (pokeinfo)
-- 2395 (portfoil) ok
-- 2382 (pokedex) ok
-- 2550 (order) ok
-- 1987 (bag) ok
-- 1988 (badge case) ok
-- 2120 (rope) ok
-- 2580 (fishing rod) ok
}
setPlayerCap(cid, 7)
if getCreatureName(cid) == "Account Manager" then
doSetCreatureOutfit(cid, {lookType = 655}, -1)
return true
end
if getPlayerStorageValue(cid, storages.BugFishing) ~= -1 then return true end

if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid > 0 then
return true
end

for _, id in ipairs(config.items) do
doPlayerAddItem(cid, id, 1)
end
local bag = getPlayerItemById(cid, false, 1988).uid
doAddContainerItem(bag, 12267, 1)
doAddContainerItem(bag, 12266, 1)
doAddContainerItem(bag, 12264, 1)
doAddContainerItem(bag, 12265, 1)
doAddContainerItem(bag, 12263, 1)
doAddContainerItem(bag, 12262, 1)
doAddContainerItem(bag, 12261, 1)
doAddContainerItem(bag, 12260, 1)
setPlayerStorageValue(cid, duelTable.wins, 0)
setPlayerStorageValue(cid, duelTable.loses, 0)
local pokeBag = getPlayerItemById(cid, false, 1987).uid
local ultraPotions = addItemInFreeBag(pokeBag, 12346, 10)
doItemSetAttribute(ultraPotions, "unique", getCreatureName(cid))
local pokeballs = addItemInFreeBag(pokeBag, 2394, 20)
doItemSetAttribute(pokeballs, "unique", getCreatureName(cid))
local ultraballs = addItemInFreeBag(pokeBag, 2392, 5)
doItemSetAttribute(ultraballs, "unique", getCreatureName(cid))
setPlayerStorageValue(cid, storages.BugFishing, 1)
doTeleportThing(cid, getTownTemplePosition(1), false)

---Corrigindo vida caso o playe relogue ---

local health = 10000 -- vida que voce colocou no robo.lua
if getPlayerStorageValue(cid, 92001) >= 1 then
setPlayerStorageValue(cid, 92001, 0)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-health)-- linha adicionada by crypter
end

return true
end

local itensShopping = {
[1] = {{2394, 100}, {12344, 25}, {12286, 2}},
[2] = {{2391, 200}, {2393, 100}, {2392, 100}},
[3] = {{12832, 1}},
[4] = {{12286, 1}},
[5] = {premiumDays = 30}
}

local lastLogin, str = getPlayerLastLoginSaved(cid)
if(lastLogin > 0) then
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
doCreatureChangeOutfit(cid, 520)
str = "Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

function doAddShoppingItem(cid)
local allItems = {}
local compra = 0
local msg = ""
local result = db.getResult("SELECT itemID, compraID FROM playercompras WHERE playerID = '" .. getPlayerGUID(cid) .. "' AND entregue = 0")
if result:getID() ~= -1 then
compra = result:getDataInt("compraID")
allItems[#allItems+1] = result:getDataInt("itemID")
db.executeQuery("UPDATE playercompras SET entregue = 13 WHERE compraID = ".. compra ..";")
while(result:next()) do
allItems[#allItems+1] = result:getDataInt("itemID")
compra = result:getDataInt("compraID")
db.executeQuery("UPDATE playercompras SET entregue = 13 WHERE compraID = ".. compra ..";")
end
end

if #allItems > 0 then
for i = 1, #allItems do
if allItems == 5 then
doPlayerAddPremiumDays(cid, itensShopping[allItems].premiumDays)
msg = "Seu pacote de '30 premium days' foi adicionado a sua conta com sucesso!"
doSendMsg(cid, msg)
else
local bag = doCreateItemEx(12694) -- cubone bag de gratis
for j = 1, #itensShopping[allItems] do
doAddContainerItem(bag, itensShopping[allItems][j][1], itensShopping[allItems][j][2])
end

doPlayerSendMailByName(getCreatureName(cid), bag, 1)
msg = "Os itens que foram comprados pelo shopping foram enviados para seu cp."
doSendMsg(cid, msg)
end
end
end
end

function addSkillsToDB(cid)
local str1 = "INSERT INTO player_skills (player_id, skillid, value, count) VALUES (" .. getPlayerGUID(cid) .. ", 5, 5, 0);"
local str2 = "INSERT INTO player_skills (player_id, skillid, value, count) VALUES (" .. getPlayerGUID(cid) .. ", 6, 5, 0);"
db.executeQuery(str1)
db.executeQuery(str2)
end
 
[31/05/2018 19:04:28] The Forgotten Server, version 0.3.6 (Crying Damson)
You should use the [.code=lua][/code] tags instead of quote tags when posting code.

Anyways test this login.lua replace the current one you use, it should work whit your server
Lua:
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function BetaItem(cid)
if getPlayerStorageValue(cid, storages.betaStorage) == -1 then
addPokeToPlayer(cid, "Squirtle", 0, nil, "poke", true)
addPokeToPlayer(cid, "Charmander", 0, nil, "poke", true)
addPokeToPlayer(cid, "Bulbasaur", 0, nil, "poke", true)
setPlayerStorageValue(cid, storages.betaStorage, 1)
doSendMsg(cid, "Vocę ganhou um Pack Inicial.")
end
end

function AutoLootinit(cid)
if getPlayerStorageValue (cid, storages.AutoLootCollectAll) == -1 then
setPlayerStorageValue(cid, storages.AutoLootCollectAll, "no")
end
return true
end

function onLogin(cid)

local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
doCreatureChangeOutfit(cid, 520)
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

if getCreatureName(cid) == "[ADM] One" then
setPlayerGroupId(cid, 15)
doRegainSpeed(cid)
doGetPlayersOnToADM(cid)
else
doSendUpdatesOnlineToADM()
end


doPlayerSetVocation(cid, 10)
doSendPlayerExtendedOpcode(cid, 126, "nao")
doResetPlayerTVSystem(cid)

if not isGod(cid) then
setPlayerGroupId(cid, 1)
doRegainSpeed(cid)
end

if isGod(cid) then -- Resetar diarias se for God
setPlayerStorageValue(cid, storages.miniQuests.storDayTask1, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask2, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask3, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask4, -1)
end

if getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 10 then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
else
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, (getPlayerLevel(cid) >= 200 and 100 or math.floor(getPlayerLevel(cid)/2)) )
end

doRegainSpeed(cid)
--////// storages \\\\\\--
doEreaseDuel(cid)
setPlayerStorageValue(cid, 500, -1)
setPlayerStorageValue(cid, 8085, 0)
--// duel
setPlayerStorageValue(cid, storages.requestCountPlayer, 0)
setPlayerStorageValue(cid, storages.requestCountPokemon, 0)
setPlayerStorageValue(cid, storages.requestedPlayer, 0)
--// duel
--////// storages \\\\\\--
--////// Eventos \\\\\\--
registerCreatureEvent(cid, "ShowPokedex")
registerCreatureEvent(cid, "ClosePokedex")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "WildAttack")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
--Adicionados \/
registerCreatureEvent(cid, "PlayerLogout")
registerCreatureEvent(cid, "LookSystem")
registerCreatureEvent(cid, "Opcode")
registerCreatureEvent(cid, "EmeraldShop")
registerCreatureEvent(cid, "PokeStats")
registerCreatureEvent(cid, "PokeWalk")
registerCreatureEvent(cid, "PokeSleep")
registerCreatureEvent(cid, "MoveItem")
registerCreatureEvent(cid, "task_count")
registerCreatureEvent(cid, "UpLevel")
registerCreatureEvent(cid, "BlockWords")
--registerCreatureEvent(cid, "PartySystem")
registerCreatureEvent(cid, "Target")
registerCreatureEvent(cid, "GeneralConfiguration")
registerCreatureEvent(cid, "EffectOnAdvance")
registerCreatureEvent(cid, "TradeRequest")
registerCreatureEvent(cid, "TradeAccpet")
registerCreatureEvent(cid, "KillTask")
--////// Eventos \\\\\\--
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end

local legs = getPlayerSlotItem(cid, CONST_SLOT_LEGS)
local ball = getPlayerSlotItem(cid, 8)

if getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= 0 then
doItemEraseAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "healthChanged")
end
--doOTCSendPokemonHealth(cid)
--doClearPokemonStatus(cid)

if isRiderOrFlyOrSurf(cid) and ball.uid ~= 0 then
local pokeName = getItemAttribute(ball.uid, "poke")

if isInArray({"ditto", "shiny ditto"}, pokeName:lower()) then
pokeName = getItemAttribute(ball.uid, "copyName")
end

local outfit = getPokemonOutfitToSkill(pokeName)
local speed = getPokemonSpeedToSkill(pokeName)
doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)

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

if isRider(cid) then
setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
elseif isFly(cid) then
setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
if not hasSqm(getThingPos(cid)) then
-- doCreateItem(460, 1, getThingPos(cid))
end
elseif isSurf(cid) then
setPlayerStorageValue(cid, orderTalks["surf"].storage, 1) -- rever o markedPos
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
end
doTeleportThing(cid, getMarkedSpawnPos(cid))
setPokemonGhost(cid)
end

setPlayerStorageValue(cid, storages.gobackDelay, -1)
setPlayerStorageValue(cid, storages.pokedexDelay, -1)
setPlayerStorageValue(cid, 154585, -1)
doAddFirstItemsToPlayer(cid)
BetaItem(cid)
AutoLootinit(cid)
--doAddShoppingItem(cid)

-- otclient life
doSendLifePokeToOTC(cid)
-- otclient life

return true
end
function doAddFirstItemsToPlayer(cid)
local config = {
storage = 30001,
items = {1988, 1987, 2382, 2120, 2550, 2580, 7385, 2395}
-- 7385 (pokeinfo)
-- 2395 (portfoil) ok
-- 2382 (pokedex) ok
-- 2550 (order) ok
-- 1987 (bag) ok
-- 1988 (badge case) ok
-- 2120 (rope) ok
-- 2580 (fishing rod) ok
}
setPlayerCap(cid, 7)
if getCreatureName(cid) == "Account Manager" then
doSetCreatureOutfit(cid, {lookType = 655}, -1)
return true
end
if getPlayerStorageValue(cid, storages.BugFishing) ~= -1 then return true end

if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid > 0 then
return true
end

for _, id in ipairs(config.items) do
doPlayerAddItem(cid, id, 1)
end
local bag = getPlayerItemById(cid, false, 1988).uid
doAddContainerItem(bag, 12267, 1)
doAddContainerItem(bag, 12266, 1)
doAddContainerItem(bag, 12264, 1)
doAddContainerItem(bag, 12265, 1)
doAddContainerItem(bag, 12263, 1)
doAddContainerItem(bag, 12262, 1)
doAddContainerItem(bag, 12261, 1)
doAddContainerItem(bag, 12260, 1)
setPlayerStorageValue(cid, duelTable.wins, 0)
setPlayerStorageValue(cid, duelTable.loses, 0)
local pokeBag = getPlayerItemById(cid, false, 1987).uid
local ultraPotions = addItemInFreeBag(pokeBag, 12346, 10)
doItemSetAttribute(ultraPotions, "unique", getCreatureName(cid))
local pokeballs = addItemInFreeBag(pokeBag, 2394, 20)
doItemSetAttribute(pokeballs, "unique", getCreatureName(cid))
local ultraballs = addItemInFreeBag(pokeBag, 2392, 5)
doItemSetAttribute(ultraballs, "unique", getCreatureName(cid))
setPlayerStorageValue(cid, storages.BugFishing, 1)
doTeleportThing(cid, getTownTemplePosition(1), false)

---Corrigindo vida caso o playe relogue ---

local health = 10000 -- vida que voce colocou no robo.lua
if getPlayerStorageValue(cid, 92001) >= 1 then
setPlayerStorageValue(cid, 92001, 0)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-health)-- linha adicionada by crypter
end

return true
end

local itensShopping = {
[1] = {{2394, 100}, {12344, 25}, {12286, 2}},
[2] = {{2391, 200}, {2393, 100}, {2392, 100}},
[3] = {{12832, 1}},
[4] = {{12286, 1}},
[5] = {premiumDays = 30}
}

function doAddShoppingItem(cid)
local allItems = {}
local compra = 0
local msg = ""
local result = db.getResult("SELECT itemID, compraID FROM playercompras WHERE playerID = '" .. getPlayerGUID(cid) .. "' AND entregue = 0")
if result:getID() ~= -1 then
compra = result:getDataInt("compraID")
allItems[#allItems+1] = result:getDataInt("itemID")
db.executeQuery("UPDATE playercompras SET entregue = 13 WHERE compraID = ".. compra ..";")
while(result:next()) do
allItems[#allItems+1] = result:getDataInt("itemID")
compra = result:getDataInt("compraID")
db.executeQuery("UPDATE playercompras SET entregue = 13 WHERE compraID = ".. compra ..";")
end
end

if #allItems > 0 then
for i = 1, #allItems do
if allItems == 5 then
doPlayerAddPremiumDays(cid, itensShopping[allItems].premiumDays)
msg = "Seu pacote de '30 premium days' foi adicionado a sua conta com sucesso!"
doSendMsg(cid, msg)
else
local bag = doCreateItemEx(12694) -- cubone bag de gratis
for j = 1, #itensShopping[allItems] do
doAddContainerItem(bag, itensShopping[allItems][j][1], itensShopping[allItems][j][2])
end

doPlayerSendMailByName(getCreatureName(cid), bag, 1)
msg = "Os itens que foram comprados pelo shopping foram enviados para seu cp."
doSendMsg(cid, msg)
end
end
end
end

function addSkillsToDB(cid)
local str1 = "INSERT INTO player_skills (player_id, skillid, value, count) VALUES (" .. getPlayerGUID(cid) .. ", 5, 5, 0);"
local str2 = "INSERT INTO player_skills (player_id, skillid, value, count) VALUES (" .. getPlayerGUID(cid) .. ", 6, 5, 0);"
db.executeQuery(str1)
db.executeQuery(str2)
end
 
Code:
[31/05/2018 19:57:27] [Error - CreatureScript Interface]
[31/05/2018 19:57:27] data/creaturescripts/scripts/player/login.lua:onLogin
[31/05/2018 19:57:27] Description:
[31/05/2018 19:57:27] attempt to index a number value
[31/05/2018 19:57:27] stack traceback:
[31/05/2018 19:57:27]     [C]: in function 'doCreatureChangeOutfit'
[31/05/2018 19:57:27]     data/creaturescripts/scripts/player/login.lua:29: in function <data/creaturescripts/scripts/player/login.lua:23>
 
Code:
[31/05/2018 19:57:27] [Error - CreatureScript Interface]
[31/05/2018 19:57:27] data/creaturescripts/scripts/player/login.lua:onLogin
[31/05/2018 19:57:27] Description:
[31/05/2018 19:57:27] attempt to index a number value
[31/05/2018 19:57:27] stack traceback:
[31/05/2018 19:57:27]     [C]: in function 'doCreatureChangeOutfit'
[31/05/2018 19:57:27]     data/creaturescripts/scripts/player/login.lua:29: in function <data/creaturescripts/scripts/player/login.lua:23>
Go to data/XML/outfits.lua and then look what outfits you have to chose from.
test different lookTypes. replace 520 whit an new lookType id
This is what is throwing the error doCreatureChangeOutfit(cid, 520)
 
Code:
<?xml version="1.0"?>
<outfits>
<!-- NORMAL -->

<outfit id="1">
<list gender="0" lookType="511" name="Trainer"/>
<list gender="1" lookType="510" name="Trainer"/>
</outfit>
<outfit id="2">
<list gender="0" lookType="615" name="Elite Trainer"/>
<list gender="1" lookType="614" name="Elite Trainer"/>
</outfit>
<outfit id="3" quest="181602">
<list gender="0" lookType="512" name="Rapper"/>
<list gender="1" lookType="545" name="Rapper"/>
</outfit>
<outfit id="4" quest="181601">
<list gender="0" lookType="588" name="Jamaican"/>
<list gender="1" lookType="587" name="Jamaican"/>
</outfit>
<outfit id="5" quest="181603">
<list gender="0" lookType="586" name="Oriental"/>
<list gender="1" lookType="585" name="Oriental"/>
</outfit>
<outfit id="6" quest="181604">
<list gender="0" lookType="605" name="Rocket"/>
<list gender="1" lookType="604" name="Rocket"/>
</outfit>
<outfit id="7" quest="181605">
<list gender="0" lookType="495" name="Adventurer"/>
<list gender="1" lookType="494" name="Adventurer"/>
</outfit>
<outfit id="8" quest="181606">
<list gender="0" lookType="513" name="Bussiness"/>
<list gender="1" lookType="1419" name="Bussiness"/>
</outfit>
<outfit id="9" quest="181607">
<list gender="0" lookType="517" name="Atletic"/>
<list gender="1" lookType="516" name="Atletic"/>
</outfit>
<outfit id="10" quest="181608">
<list gender="0" lookType="519" name="Punk"/>
<list gender="1" lookType="518" name="Punk"/>
</outfit>
<outfit id="11">
<list gender="0" lookType="521" name="Fisher"/>
<list gender="1" lookType="520" name="Fisher"/>
</outfit>
<outfit id="12" quest="181610">
<list gender="0" lookType="524" name="Mercenary"/>
<list gender="1" lookType="522" name="Mercenary"/>
</outfit>
<outfit id="13" quest="181611">
<list gender="0" lookType="525" name="Hiker"/>
<list gender="1" lookType="523" name="Hiker"/>
</outfit>
<!-- PROMOTE -->

<outfit id="14" quest="181612">
<list gender="0" lookType="1149" name="Naturia"/>
<list gender="1" lookType="1159" name="Naturia"/>
</outfit>
<outfit id="15" quest="181613">
<list gender="0" lookType="1152" name="Volcanic"/>
<list gender="1" lookType="1154" name="Volcanic"/>
</outfit>
<outfit id="16" quest="181614">
<list gender="0" lookType="1146" name="Gardestrike"/>
<list gender="1" lookType="1155" name="Gardestrike"/>
</outfit>
<outfit id="17" quest="181615">
<list gender="0" lookType="1153" name="Malefic"/>
<list gender="1" lookType="1157" name="Malefic"/>
</outfit>
<outfit id="18" quest="181616">
<list gender="0" lookType="1148" name="Wingeon"/>
<list gender="1" lookType="1158" name="Wingeon"/>
</outfit>
<outfit id="19" quest="181617">
<list gender="0" lookType="1147" name="Raibolt"/>
<list gender="1" lookType="1160" name="Raibolt"/>
</outfit>
<outfit id="20" quest="181618">
<list gender="0" lookType="1145" name="Psycraft"/>
<list gender="1" lookType="1161" name="Psycraft"/>
</outfit>
<outfit id="21" quest="181619">
<list gender="0" lookType="1151" name="Seavell"/>
<list gender="1" lookType="1162" name="Seavell"/>
</outfit>
<outfit id="22" quest="181620">
<list gender="0" lookType="1150" name="Orebound"/>
<list gender="1" lookType="1156" name="Orebound"/>
</outfit>

<!-- PROMOTE RANK 5 -->

<outfit id="23" quest="181621">
<list gender="0" lookType="1437" name="Raibolt Master"/>
<list gender="1" lookType="1421" name="Raibolt Master"/>
</outfit>
<outfit id="24" quest="181622">
<list gender="0" lookType="1438" name="Seavell Master"/>
<list gender="1" lookType="1422" name="Seavell Master"/>
</outfit>
<outfit id="25" quest="181623">
<list gender="0" lookType="1434" name="Naturia Master"/>
<list gender="1" lookType="1423" name="Naturia Master"/>
</outfit>
<outfit id="26" quest="181624">
<list gender="0" lookType="1430" name="Malefic Master"/>
<list gender="1" lookType="1428" name="Malefic Master"/>
</outfit>
<outfit id="27" quest="181625">
<list gender="0" lookType="1432" name="Volcanic Superior"/>
<list gender="1" lookType="1425" name="Volcanic Superior"/>
</outfit>
<outfit id="28" quest="181626">
<list gender="0" lookType="1433" name="Wingeon Master"/>
<list gender="1" lookType="1424" name="Wingeon Master"/>
</outfit>
<outfit id="29" quest="181627">
<list gender="0" lookType="1436" name="Orebound Master"/>
<list gender="1" lookType="1427" name="Orebound Master"/>
</outfit>
<outfit id="30" quest="181628">
<list gender="0" lookType="1431" name="Gardestrike Master"/>
<list gender="1" lookType="1429" name="Gardestrike Master"/>
</outfit>
<outfit id="31" quest="181629">
<list gender="0" lookType="1435" name="Psycraft Master"/>
<list gender="1" lookType="1426" name="Psycraft Master"/>
</outfit>

<!-- PROMOTE MASTER -->

<outfit id="32" quest="10051">
<list gender="0" lookType="2101" name="Iron Hard Master"/>
<list gender="1" lookType="2102" name="Iron Hard Master"/>
</outfit>
<outfit id="33" quest="10050">
<list gender="0" lookType="2126" name="Iron Hard"/>
<list gender="1" lookType="2125" name="Iron Hard"/>
</outfit>
<outfit id="34" quest="181632">
<list gender="0" lookType="1434" name="Naturia Master"/>
<list gender="1" lookType="1423" name="Naturia Master"/>
</outfit>
<outfit id="35" quest="181633">
<list gender="0" lookType="1430" name="Malefic Master"/>
<list gender="1" lookType="1428" name="Malefic Master"/>
</outfit>
<outfit id="36" quest="181634">
<list gender="0" lookType="1432" name="Volcanic Superior"/>
<list gender="1" lookType="1425" name="Volcanic Superior"/>
</outfit>
<outfit id="37" quest="181635">
<list gender="0" lookType="1433" name="Wingeon Master"/>
<list gender="1" lookType="1424" name="Wingeon Master"/>
</outfit>
<outfit id="38" quest="181636">
<list gender="0" lookType="1436" name="Orebound Master"/>
<list gender="1" lookType="1427" name="Orebound Master"/>
</outfit>
<outfit id="39" quest="181637">
<list gender="0" lookType="1431" name="Gardestrike Master"/>
<list gender="1" lookType="1429" name="Gardestrike Master"/>
</outfit>
<outfit id="40" quest="181638">
<list gender="0" lookType="1435" name="Psycraft Master"/>
<list gender="1" lookType="1426" name="Psycraft Master"/>
</outfit>

<!-- GAMEMASTER -->

<outfit id="41" access = "4">
<list gender="0-3" lookType="664" name="GameMaster"/>
</outfit>
<outfit id="42" access = "4">
<list gender="1" lookType="610" name="Reporter"/>
</outfit>


<!-- NATAL -->

<outfit id="43" quest="181639">
<list gender="0" lookType="661" name="Christmas"/>
<list gender="1" lookType="662" name="Christmas"/>
</outfit>
<outfit id="44" quest="181640">
<list gender="0" lookType="1084" name="Christmas 2"/>
<list gender="1" lookType="1083" name="Christmas 2"/>
</outfit>

<!-- HALLOWEEN -->

<outfit id="45" quest="181641">
<list gender="0-3" lookType="1140" name="Mummy"/>
</outfit>
<outfit id="46" quest="181642">
<list gender="0" lookType="1190" name="Bruxa"/>
<list gender="1" lookType="1191" name="Dracula"/>
</outfit>
<outfit id="47" quest="181643">
<list gender="0" lookType="1188" name="Caveira"/>
<list gender="1" lookType="1189" name="Diaba"/>
</outfit>

<!-- CATCHER -->

<outfit id="48" quest="181644">
<list gender="0" lookType="1414" name="Catcher"/>
<list gender="1" lookType="1413" name="Catcher"/>
</outfit>

<!-- ESPECIAIS -->

<outfit id="49" quest="181645">
<list gender="0" lookType="1016" name="Hunter"/>
<list gender="1" lookType="1015" name="Hunter"/>
</outfit>
<outfit id="50" quest="181646">
<list gender="0" lookType="1035" name="Mergulhadora"/>
<list gender="1" lookType="1034" name="Mergulhador"/>
</outfit>
<outfit id="51" quest="181647">
<list gender="0" lookType="1408" name="Esquiadora"/>
<list gender="1" lookType="1407" name="Esquiador"/>
</outfit>
<outfit id="52" quest="181648">
<list gender="1" lookType="1441" name="Slash"/>
</outfit>
<outfit id="53" quest="181649">
<list gender="0" lookType="1442" name="Playboy"/>
</outfit>
<outfit id="54" quest="181650">
<list gender="1" lookType="1443" name="Vinganca"/>
</outfit>
<outfit id="55" quest="181651">
<list gender="1" lookType="1444" name="House"/>
</outfit>
<outfit id="56" quest="181652">
<list gender="0" lookType="1184" name="Police Officer"/>
<list gender="1" lookType="1183" name="Police Officer"/>
</outfit>
<outfit id="57" quest="181653">
<list gender="0" lookType="1466" name="Veteran Trainer"/>
<list gender="1" lookType="1465" name="Veteran Trainer"/>
</outfit>
<outfit id="58" quest="181654">
<list gender="0" lookType="1469" name="Assassin"/>
<list gender="1" lookType="1470" name="Assassin"/>
</outfit>
<outfit id="59" quest="181655">
<list gender="0" lookType="1498" name="Natal"/>
<list gender="1" lookType="1497" name="Natal"/>
</outfit>

<outfit id="60" >
<list gender="0" lookType="1668" name="TG"/>
<list gender="1" lookType="1669" name="TG"/>
</outfit>

<outfit id="61" >
<list gender="0" lookType="1666" name="TG1"/>
<list gender="1" lookType="1667" name="TG2"/>
</outfit>

<outfit id="62" quest="20020">
<list gender="0" lookType="1674" name="Brotherhood"/>
<list gender="1" lookType="1673" name="Brotherhood"/>
</outfit>

<outfit id="63" quest="20019">
<list gender="0" lookType="1672" name="Duelist"/>
<list gender="1" lookType="1671" name="Duelist"/>
</outfit>

<outfit id="64" >
<list gender="1" lookType="1670" name="Dr.House"/>
</outfit>

<outfit id="65" >
<list gender="1" lookType="1675" name="Enginer"/>
</outfit>

<outfit id="66" >
<list gender="1" lookType="1676" name="Enginer"/>
</outfit>

<outfit id="67" >
<list gender="0" lookType="1677" name="Christmas 3"/>
<list gender="1" lookType="1678" name="Christmas 3"/>
</outfit>

<outfit id="68" >
<list gender="0" lookType="1679" name="Rabbit"/>
<list gender="1" lookType="1680" name="Rabbit"/>
</outfit>

<outfit id="69" >
<list gender="1" lookType="1681" name="Wolf Man"/>
</outfit>

<outfit id="70" >
<list gender="0" lookType="1682" name="Morgana"/>
</outfit>

<outfit id="71" >
<list gender="0" lookType="1685" name="Test1"/>
<list gender="1" lookType="1686" name="Test1"/>
</outfit>

<outfit id="72" >
<list gender="0" lookType="1688" name="Test2"/>
<list gender="1" lookType="1687" name="Test2"/>
</outfit>

<outfit id="73" >
<list gender="0" lookType="1690" name="Test3"/>
<list gender="1" lookType="1689" name="Test3"/>
</outfit>

<outfit id="74" >
<list gender="0" lookType="1691" name="Test4"/>
<list gender="1" lookType="1692" name="Test4"/>
</outfit>

<outfit id="75" >
<list gender="1" lookType="1693" name="Test5"/>
</outfit>

<outfit id="76" >
<list gender="1" lookType="1694" name="Test6"/>
</outfit>

<outfit id="77" >
<list gender="1" lookType="1695" name="Test7"/>
</outfit>

<outfit id="78" >
<list gender="1" lookType="1696" name="Test8"/>
</outfit>

<outfit id="79" >
<list gender="0" lookType="1697" name="Test9"/>
</outfit>

<outfit id="80" >
<list gender="0" lookType="1698" name="Test10"/>
</outfit>

<outfit id="81" >
<list gender="1" lookType="1699" name="Test11"/>
</outfit>

<outfit id="82" >
<list gender="1" lookType="1700" name="Test12"/>
</outfit>

<outfit id="83" >
<list gender="1" lookType="1701" name="Test13"/>
</outfit>

<outfit id="84" >
<list gender="0" lookType="1702" name="Test14"/>
</outfit>

<outfit id="85" >
<list gender="1" lookType="1703" name="Test15"/>
</outfit>

<outfit id="86" >
<list gender="0" lookType="1704" name="Test16"/>
</outfit>

<outfit id="87" >
<list gender="0" lookType="1705" name="Test17"/>
</outfit>

<outfit id="88" >
<list gender="0" lookType="1706" name="Test18"/>
</outfit>

<outfit id="89" >
<list gender="1" lookType="1707" name="Test19"/>
</outfit>

<outfit id="90" >
<list gender="1" lookType="1708" name="Test20"/>
</outfit>

<outfit id="91" >
<list gender="1" lookType="1709" name="Test21"/>
</outfit>

<outfit id="92" >
<list gender="0" lookType="1710" name="Test22"/>
</outfit>

<outfit id="93" >
<list gender="0" lookType="1711" name="Test23"/>
<list gender="1" lookType="1712" name="Test23"/>
</outfit>

<outfit id="94" >
<list gender="1" lookType="1713" name="Test24"/>
</outfit>

<outfit id="95" >
<list gender="0" lookType="1714" name="Test25"/>
<list gender="1" lookType="1715" name="Test25"/>
</outfit>

<outfit id="96" >
<list gender="0" lookType="1717" name="Test26"/>
<list gender="1" lookType="1716" name="Test26"/>
</outfit>

<outfit id="97" >
<list gender="0" lookType="1718" name="Test27"/>
</outfit>

<outfit id="98" >
<list gender="0" lookType="1719" name="Test28"/>
</outfit>

<outfit id="99" >
<list gender="1" lookType="1720" name="Test29"/>
</outfit>

<outfit id="100" >
<list gender="0" lookType="1721" name="Test30"/>
</outfit>

<outfit id="101" >
<list gender="0" lookType="1722" name="Test31"/>
</outfit>

</outfits>
 
Ehh next ;/

Code:
[01/06/2018 13:38:38] [Error - CreatureScript Interface]
[01/06/2018 13:38:38] data/creaturescripts/scripts/player/login.lua:onLogin
[01/06/2018 13:38:38] Description:
[01/06/2018 13:38:38] attempt to index a number value
[01/06/2018 13:38:38] stack traceback:
[01/06/2018 13:38:38]     [C]: in function 'doCreatureChangeOutfit'
[01/06/2018 13:38:38]     data/creaturescripts/scripts/player/login.lua:29: in function <data/creaturescripts/scripts/player/login.lua:23>
 
Code:
[01/06/2018 15:19:32] [Error - CreatureScript Interface]
[01/06/2018 15:19:32] data/creaturescripts/scripts/player/login.lua:onLogin
[01/06/2018 15:19:32] Description:
[01/06/2018 15:19:32] attempt to index a number value
[01/06/2018 15:19:32] stack traceback:
[01/06/2018 15:19:32]     [C]: in function 'doCreatureChangeOutfit'
[01/06/2018 15:19:32]     data/creaturescripts/scripts/player/login.lua:29: in function <data/creaturescripts/scripts/player/login.lua:23>

and
aa224bb3adb8e.png
 
outfit needs to be a table not a number
Lua:
local outfit = getCreatureOutfit(cid)
outfit.lookType = OUTFIT_ID_HERE
doCreatureSetOutfit(cid, outfit)
 
you use what i posted instead of what samco posted in your script and replace OUTFIT_ID_HERE to whatever
 
My login lua looks like this:

Code:
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
function BetaItem(cid)
if getPlayerStorageValue(cid, storages.betaStorage) == -1 then
addPokeToPlayer(cid, "Squirtle", 0, nil, "poke", true)
addPokeToPlayer(cid, "Charmander", 0, nil, "poke", true)
addPokeToPlayer(cid, "Bulbasaur", 0, nil, "poke", true)
setPlayerStorageValue(cid, storages.betaStorage, 1)
doSendMsg(cid, "Vocę ganhou um Pack Inicial.")
end
end
function AutoLootinit(cid)
if getPlayerStorageValue (cid, storages.AutoLootCollectAll) == -1 then
setPlayerStorageValue(cid, storages.AutoLootCollectAll, "no")
end
return true
end
function onLogin(cid)
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
doCreatureChangeOutfit(cid, 11)
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
if getCreatureName(cid) == "[ADM] One" then
setPlayerGroupId(cid, 15)
doRegainSpeed(cid)
doGetPlayersOnToADM(cid)
else
doSendUpdatesOnlineToADM()
end
doPlayerSetVocation(cid, 10)
doSendPlayerExtendedOpcode(cid, 126, "nao")
doResetPlayerTVSystem(cid)
if not isGod(cid) then
setPlayerGroupId(cid, 1)
doRegainSpeed(cid)
end
if isGod(cid) then -- Resetar diarias se for God
setPlayerStorageValue(cid, storages.miniQuests.storDayTask1, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask2, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask3, -1)
setPlayerStorageValue(cid, storages.miniQuests.storDayTask4, -1)
end
if getPlayerLevel(cid) >= 1 and getPlayerLevel(cid) <= 10 then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 0)
else
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, (getPlayerLevel(cid) >= 200 and 100 or math.floor(getPlayerLevel(cid)/2)) )
end
doRegainSpeed(cid)
--////// storages \\\\\\--
doEreaseDuel(cid)
setPlayerStorageValue(cid, 500, -1)
setPlayerStorageValue(cid, 8085, 0)
--// duel
setPlayerStorageValue(cid, storages.requestCountPlayer, 0)
setPlayerStorageValue(cid, storages.requestCountPokemon, 0)
setPlayerStorageValue(cid, storages.requestedPlayer, 0)
--// duel
--////// storages \\\\\\--
--////// Eventos \\\\\\--
registerCreatureEvent(cid, "ShowPokedex")
registerCreatureEvent(cid, "ClosePokedex")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "WildAttack")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
--Adicionados \/
registerCreatureEvent(cid, "PlayerLogout")
registerCreatureEvent(cid, "LookSystem")
registerCreatureEvent(cid, "Opcode")
registerCreatureEvent(cid, "EmeraldShop")
registerCreatureEvent(cid, "PokeStats")
registerCreatureEvent(cid, "PokeWalk")
registerCreatureEvent(cid, "PokeSleep")
registerCreatureEvent(cid, "MoveItem")
registerCreatureEvent(cid, "task_count")
registerCreatureEvent(cid, "UpLevel")
registerCreatureEvent(cid, "BlockWords")
--registerCreatureEvent(cid, "PartySystem")
registerCreatureEvent(cid, "Target")
registerCreatureEvent(cid, "GeneralConfiguration")
registerCreatureEvent(cid, "EffectOnAdvance")
registerCreatureEvent(cid, "TradeRequest")
registerCreatureEvent(cid, "TradeAccpet")
registerCreatureEvent(cid, "KillTask")
--////// Eventos \\\\\\--
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
local legs = getPlayerSlotItem(cid, CONST_SLOT_LEGS)
local ball = getPlayerSlotItem(cid, 8)
if getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= 0 then
doItemEraseAttribute(getPlayerSlotItem(cid, CONST_SLOT_FEET).uid, "healthChanged")
end
--doOTCSendPokemonHealth(cid)
--doClearPokemonStatus(cid)
if isRiderOrFlyOrSurf(cid) and ball.uid ~= 0 then
local pokeName = getItemAttribute(ball.uid, "poke")
if isInArray({"ditto", "shiny ditto"}, pokeName:lower()) then
pokeName = getItemAttribute(ball.uid, "copyName")
end
local outfit = getPokemonOutfitToSkill(pokeName)
local speed = getPokemonSpeedToSkill(pokeName)
doSetCreatureOutfit(cid, {lookType = outfit + 351}, -1)
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, speed)
if isRider(cid) then
setPlayerStorageValue(cid, orderTalks["ride"].storage, 1)
elseif isFly(cid) then
setPlayerStorageValue(cid, orderTalks["fly"].storage, 1)
if not hasSqm(getThingPos(cid)) then
-- doCreateItem(460, 1, getThingPos(cid))
end
elseif isSurf(cid) then
setPlayerStorageValue(cid, orderTalks["surf"].storage, 1) -- rever o markedPos
doChangeSpeed(cid, -getCreatureSpeed(cid))
doChangeSpeed(cid, getPlayerStorageValue(cid, 54844))
end
doTeleportThing(cid, getMarkedSpawnPos(cid))
setPokemonGhost(cid)
end
setPlayerStorageValue(cid, storages.gobackDelay, -1)
setPlayerStorageValue(cid, storages.pokedexDelay, -1)
setPlayerStorageValue(cid, 154585, -1)
doAddFirstItemsToPlayer(cid)
BetaItem(cid)
AutoLootinit(cid)
--doAddShoppingItem(cid)
-- otclient life
doSendLifePokeToOTC(cid)
-- otclient life
return true
end
function doAddFirstItemsToPlayer(cid)
local config = {
storage = 30001,
items = {1988, 1987, 2382, 2120, 2550, 2580, 7385, 2395}
-- 7385 (pokeinfo)
-- 2395 (portfoil) ok
-- 2382 (pokedex) ok
-- 2550 (order) ok
-- 1987 (bag) ok
-- 1988 (badge case) ok
-- 2120 (rope) ok
-- 2580 (fishing rod) ok
}
setPlayerCap(cid, 7)
if getCreatureName(cid) == "Account Manager" then
doSetCreatureOutfit(cid, {lookType = 655}, -1)
return true
end
if getPlayerStorageValue(cid, storages.BugFishing) ~= -1 then return true end
if getPlayerSlotItem(cid, CONST_SLOT_ARMOR).itemid > 0 then
return true
end
for _, id in ipairs(config.items) do
doPlayerAddItem(cid, id, 1)
end
local bag = getPlayerItemById(cid, false, 1988).uid
doAddContainerItem(bag, 12267, 1)
doAddContainerItem(bag, 12266, 1)
doAddContainerItem(bag, 12264, 1)
doAddContainerItem(bag, 12265, 1)
doAddContainerItem(bag, 12263, 1)
doAddContainerItem(bag, 12262, 1)
doAddContainerItem(bag, 12261, 1)
doAddContainerItem(bag, 12260, 1)
setPlayerStorageValue(cid, duelTable.wins, 0)
setPlayerStorageValue(cid, duelTable.loses, 0)
local pokeBag = getPlayerItemById(cid, false, 1987).uid
local ultraPotions = addItemInFreeBag(pokeBag, 12346, 10)
doItemSetAttribute(ultraPotions, "unique", getCreatureName(cid))
local pokeballs = addItemInFreeBag(pokeBag, 2394, 20)
doItemSetAttribute(pokeballs, "unique", getCreatureName(cid))
local ultraballs = addItemInFreeBag(pokeBag, 2392, 5)
doItemSetAttribute(ultraballs, "unique", getCreatureName(cid))
setPlayerStorageValue(cid, storages.BugFishing, 1)
doTeleportThing(cid, getTownTemplePosition(1), false)
---Corrigindo vida caso o playe relogue ---
local health = 10000 -- vida que voce colocou no robo.lua
if getPlayerStorageValue(cid, 92001) >= 1 then
setPlayerStorageValue(cid, 92001, 0)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)-health)-- linha adicionada by crypter
end
return true
end
local itensShopping = {
[1] = {{2394, 100}, {12344, 25}, {12286, 2}},
[2] = {{2391, 200}, {2393, 100}, {2392, 100}},
[3] = {{12832, 1}},
[4] = {{12286, 1}},
[5] = {premiumDays = 30}
}
function doAddShoppingItem(cid)
local allItems = {}
local compra = 0
local msg = ""
local result = db.getResult("SELECT itemID, compraID FROM playercompras WHERE playerID = '" .. getPlayerGUID(cid) .. "' AND entregue = 0")
if result:getID() ~= -1 then
compra = result:getDataInt("compraID")
allItems[#allItems+1] = result:getDataInt("itemID")
db.executeQuery("UPDATE playercompras SET entregue = 13 WHERE compraID = ".. compra ..";")
while(result:next()) do
allItems[#allItems+1] = result:getDataInt("itemID")
compra = result:getDataInt("compraID")
db.executeQuery("UPDATE playercompras SET entregue = 13 WHERE compraID = ".. compra ..";")
end
end
if #allItems > 0 then
for i = 1, #allItems do
if allItems == 5 then
doPlayerAddPremiumDays(cid, itensShopping[allItems].premiumDays)
msg = "Seu pacote de '30 premium days' foi adicionado a sua conta com sucesso!"
doSendMsg(cid, msg)
else
local bag = doCreateItemEx(12694) -- cubone bag de gratis
for j = 1, #itensShopping[allItems] do
doAddContainerItem(bag, itensShopping[allItems][j][1], itensShopping[allItems][j][2])
end
doPlayerSendMailByName(getCreatureName(cid), bag, 1)
msg = "Os itens que foram comprados pelo shopping foram enviados para seu cp."
doSendMsg(cid, msg)
end
end
end
end
function addSkillsToDB(cid)
local str1 = "INSERT INTO player_skills (player_id, skillid, value, count) VALUES (" .. getPlayerGUID(cid) .. ", 5, 5, 0);"
local str2 = "INSERT INTO player_skills (player_id, skillid, value, count) VALUES (" .. getPlayerGUID(cid) .. ", 6, 5, 0);"
db.executeQuery(str1)
db.executeQuery(str2)
end
 
Back
Top