--[[
Script by Shawak
Login version 4.0
]]--
dofile("war.lua")
local text = "Welcome to JKJLRJ's War server, here a list with all commands:\n!online -> See online players\n!uptime -> See server uptime\n!points -> See your points (kill someone to get them)\n!highscore -> See the highscore"
local Level = getConfigValue("newPlayerLevel")
local Exp = getExperienceForLevel(Level)
function onLogin(cid)
local outfits = {
[1] = {
lookType = math.random(128,134),
lookHead = math.random(0,132),
lookBody = math.random(0,132),
lookLegs = math.random(0,132),
lookFeet = math.random(0,132),
lookTypeEx = 0,
lookAddons = 0
},
[2] = {
lookType = math.random(136,142),
lookHead = math.random(0,132),
lookBody = math.random(0,132),
lookLegs = math.random(0,132),
lookFeet = math.random(0,132),
lookTypeEx = 0,
lookAddons = 0
}
}
local accountManager = getPlayerAccountManager(cid)
if(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'.")
elseif(accountManager == MANAGER_NEW) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end
if getCreatureName(cid) ~= "Account Manager" and getPlayerGroupId(cid) == 1 then
local vocs = {
sorc,
druid,
paladin,
knight,
sorc,
druid,
paladin,
knight
}
local voc = vocs[getPlayerVocation(cid)]
if getPlayerLevel(cid) ~= Level or getPlayerMagLevel(cid) ~= voc.MagicLevel or getPlayerMaxCap(cid) ~= voc.Cap or getCreatureMaxHealth(cid) ~= voc.Leben or getCreatureMaxMana(cid) ~= voc.Mana or getPlayerSkillLevel(cid, 0) ~= voc.Fist or getPlayerSkillLevel(cid, 1) ~= voc.Club or getPlayerSkillLevel(cid, 2) ~= voc.Sword or getPlayerSkillLevel(cid, 3) ~= voc.Axe or getPlayerSkillLevel(cid, 4) ~= voc.Dist or getPlayerSkillLevel(cid, 5) ~= voc.Shield then
doPlayerPopupFYI(cid, "~~ "..getConfigValue('serverName').." Startup ~~\nCharacter Update:\n• Level: ["..getPlayerLevel(cid).."] -> ["..Level.."]\n• MagicLvl: ["..getPlayerMagLevel(cid).."] -> ["..voc.MagicLevel.."]\n• Hp: ["..getCreatureMaxHealth(cid).."] -> ["..voc.Leben.."]\n• Mana: ["..getCreatureMaxMana(cid).."] -> ["..voc.Leben.."]\n• Cap: ["..getPlayerMaxCap(cid).."] -> ["..voc.Cap.."]\n• Skills:\n - Fist: ["..getPlayerSkillLevel(cid, 0).."] -> ["..voc.Fist.."]\n - Club: ["..getPlayerSkillLevel(cid, 1).."] -> ["..voc.Club.."]\n - Sword: ["..getPlayerSkillLevel(cid, 2).."] -> ["..voc.Sword.."]\n - Axe: ["..getPlayerSkillLevel(cid, 3).."] -> ["..voc.Axe.."]\n - Distance: ["..getPlayerSkillLevel(cid, 4).."] -> ["..voc.Dist.."]\n - Shielding: ["..getPlayerSkillLevel(cid, 5).."] -> ["..voc.Shield.."]\n\nReason for Update:\nYour character wasn't on the newest update,\nhe/she had a wrong level/magiclevel/skills.\nThis have been fixed, so please login again!")
pname = getCreatureName(cid)
pguid = getPlayerGUID(cid)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `save` = 1 WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `health` = "..voc.Leben.." WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `healthmax` = "..voc.Leben.." WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `mana` = "..voc.Mana.." WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `manamax` = "..voc.Mana.." WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `level` = "..Level.." WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `experience` = "..Exp.." WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `maglevel` = "..voc.MagicLevel.." WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `cap` = "..voc.Cap.." WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `players` SET `lastlogin` = 1249657933 WHERE `name` = '" .. pname .. "';")
db.executeQuery("UPDATE `player_skills` SET `value` = "..voc.Fist.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 0;")
db.executeQuery("UPDATE `player_skills` SET `value` = "..voc.Club.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 1;")
db.executeQuery("UPDATE `player_skills` SET `value` = "..voc.Sword.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 2;")
db.executeQuery("UPDATE `player_skills` SET `value` = "..voc.Axe.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 3;")
db.executeQuery("UPDATE `player_skills` SET `value` = "..voc.Dist.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 4;")
db.executeQuery("UPDATE `player_skills` SET `value` = "..voc.Shield.." WHERE `player_id` = " .. pguid .. " AND `skillid` = 5;")
db.executeQuery("UPDATE `players` SET `save` = 0 WHERE `name` = '" .. pname .. "';")
return true
else
local outfit = outfits[2-getPlayerSex(cid)]
registerCreatureEvent(cid, "Idle")
registerCreatureEvent(cid, "SkullCheck")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "Kill")
doPlayerAddAddons(cid, 0)
doPlayerAddAddons(cid, 0)
setPlayerPromotionLevel(cid, 1)
doCreatureChangeOutfit(cid, outfit)
doCreatureAddHealth(cid,getCreatureMaxHealth(cid)-getCreatureHealth(cid))
doCreatureAddMana(cid,getCreatureMaxMana(cid)-getCreatureMana(cid))
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, text)
doPlayerAddEquiqment(cid)
doTeleportThing(cid, (start_pos[getGlobalStorageValue(world_storage)].positions[math.random(1, #start_pos[getGlobalStorageValue(world_storage)].positions)]))
doSendMagicEffect(getCreaturePosition(cid),10)
return true
end
end
return true
end