im using tfs 0.4 3777 with account manager ingame !
this is my login.lua
Code:
local skillConfig = {
query = {"UPDATE player_skills SET value = SFIST WHERE skillid = 0 AND player_id = PID",
"UPDATE player_skills SET value = SCLUB WHERE skillid = 1 AND player_id = PID",
"UPDATE player_skills SET value = SSWORD WHERE skillid = 2 AND player_id = PID",
"UPDATE player_skills SET value = SAXE WHERE skillid = 3 AND player_id = PID",
"UPDATE player_skills SET value = SDIST WHERE skillid = 4 AND player_id = PID",
"UPDATE player_skills SET value = SSHIELD WHERE skillid = 5 AND player_id = PID",
"UPDATE player_skills SET value = SFISH WHERE skillid = 6 AND player_id = PID",
"UPDATE players SET maglevel = SMAG WHERE id = PID"},
skillNames = {"SFIST", "SCLUB", "SSWORD", "SAXE", "SDIST", "SSHIELD", "SFISH", "SMAG"},
vocations = {
[{1, 5}] = { -- Sorcerers
[0] = 10,
[1] = 10,
[2] = 10,
[3] = 10,
[4] = 10,
[5] = 30,
[6] = 10,
[7] = 10
},
[{2, 6}] = { -- Druids
[0] = 10,
[1] = 10,
[2] = 10,
[3] = 10,
[4] = 10,
[5] = 30,
[6] = 10,
[7] = 10
},
[3] = { -- Paladins
[0] = 10,
[1] = 10,
[2] = 10,
[3] = 10,
[4] = 75,
[5] = 50,
[6] = 10,
[7] = 5
},
[4] = { -- Knights
[0] = 10,
[1] = 75,
[2] = 75,
[3] = 75,
[4] = 10,
[5] = 75,
[6] = 10,
[7] = 20
}
}
}
local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
end
if getPlayerLastLoginSaved(cid) <= 0 then
local vocationSettings = nil
for vocs, setting in pairs(skillConfig.vocations) do
if type(vocs) == "table" and isInArray(vocs, getPlayerVocation(cid)) or type(vocs) == "number" and vocs == getPlayerVocation(cid) then
vocationSettings = setting
break
end
end
if vocationSettings then
local GUID = getPlayerGUID(cid)
for i = 1, #skillConfig.query do
local tmpQuery = skillConfig.query
tmpQuery = tmpQuery:gsub("PID", GUID)
tmpQuery = tmpQuery:gsub(skillConfig.skillNames, vocationSettings[i - 1])
addEvent(db.query, 150, tmpQuery)
end
addEvent(doRemoveCreature, 100, cid)
return true
end
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 = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildMotd")
registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
doCreatureSetStorage(cid, 6000, -1) -- storrage for Current frags like in onKill script
registerCreatureEvent(cid, "killCount")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "AdvanceSave")
registerCreatureEvent(cid, "GuildXP")
registerCreatureEvent(cid, "Logout")
return true
end
BUMP
bring up my post
BUMP WTF
Last edited by a moderator: