• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Anyone can see this script? im REP +

Stewie

Family Guy # ;3
Joined
May 3, 2010
Messages
786
Reaction score
12
Location
TV
See this error:

LUA:
[29/07/2010 23:15:57] [Error - CreatureScript Interface] 
[29/07/2010 23:15:57] data/creaturescripts/scripts/Setup.lua:onLogin
[29/07/2010 23:15:57] Description: 
[29/07/2010 23:15:57] data/creaturescripts/scripts/Setup.lua:133: attempt to call global 'setPlayerStorageValue' (a nil value)
[29/07/2010 23:15:57] stack traceback:
[29/07/2010 23:15:57] 	data/creaturescripts/scripts/Setup.lua:133: in function <data/creaturescripts/scripts/Setup.lua:22>

Script:

LUA:
--[[	
	Script by Shawak
]]--

dofile("war.lua")

local texts = {
	"Welcome to "..getConfigValue("ownerName").."'s War server, here a list with all commands:",
	"!online                  -> Ver players online",
	"!uptime                -> Ver UPTime do server",
	"!frags                 -> Ver seus frags",
	"!highscore          -> Ver o rank",
	"!setoutfit          -> Salvar sua atual outfit",
	"!getoutfit          -> Trocar sua outfit para qual foi salvada",
	"!go          -> Muda para a mesma roupa que o lider da party"
}

local Level = getConfigValue("newPlayerLevel")
local Exp = getExperienceForLevel(Level)

function onLogin(cid)

	if getCreatureName(cid) ~= "Account Manager" and isPlayerExample(cid) == false then
		if isPlayerOnline(cid) == false then
			setPlayerStatusOnline(cid)
		else
			doPlayerPopupFYI(cid, "You are already logged in.")
			doRemoveCreature(cid, false)
			return false
		end
	end

	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 = 3
		},
		[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 = 3
		}
	}

	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")
			registerCreatureEvent(cid, "Party Attack")
			registerCreatureEvent(cid, "AntiDmg")
			registerCreatureEvent(cid, "Timer")
			registerCreatureEvent(cid, "Death")

        		doPlayerAddAddons(cid, 1)
        		doPlayerAddAddons(cid, 2)

			setPlayerPromotionLevel(cid, 1)
			doCreatureChangeOutfit(cid, outfit)

			doCreatureAddHealth(cid,getCreatureMaxHealth(cid)-getCreatureHealth(cid))
			doCreatureAddMana(cid,getCreatureMaxMana(cid)-getCreatureMana(cid))

			for t = 1, #texts do
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, texts[t])
			end

			doPlayerAddEquiqment(cid)

			setPlayerStorageValue(cid, anti_party_attack_msg_storage, os.time())
			setPlayerStorageValue(cid, anti_party_talkaction_storage, os.time())
			setPlayerStorageValue(cid, outfit_saving_exhaustion, os.time())

			doTeleportThing(cid, (start_pos[getGlobalStorageValue(world_storage)].positions[math.random(1, #start_pos[getGlobalStorageValue(world_storage)].positions)]))
			doSendMagicEffect(getCreaturePosition(cid),10)

			if string.lower(showLoginsAndLogouts) == "yes" then
				if isPlayerExample(cid) == true then
					print(getCreatureName(cid).." [Example] logged in.")
					doPlayerSendExamplesWindow(cid)
				else
					print(getCreatureName(cid).." ["..getPlayerPoints(cid).." Points] logged in.")
				end
			end
			return true
		end
	end
	if string.lower(showLoginsAndLogouts) == "yes" then
		print(getCreatureName(cid).." [-] logged in.")
	end
	return true
end

----------------------------------------------------------

Other script:

error:

LUA:
[29/07/2010 23:22:33] [Error - GlobalEvent Interface] 
[29/07/2010 23:22:33] data/globalevents/scripts/start.lua:onStartup
[29/07/2010 23:22:33] Description: 
[29/07/2010 23:22:33] data/globalevents/scripts/start.lua:42: attempt to call global 'setGlobalStorageValue' (a nil value)
[29/07/2010 23:22:33] stack traceback:
[29/07/2010 23:22:33] 	data/globalevents/scripts/start.lua:42: in function <data/globalevents/scripts/start.lua:3>

Script:

LUA:
dofile("war.lua")

function onStartup()
 
	-- player info
	local time = os.clock()
	local players = getCurrentPlayers()
	print(">> The server have "..#players.." registred players.")
	print("> Create registred players.txt ...")

	local file__ = io.open('Registred Players.txt','w')
	file__:write('You server have '..#players..' registred players:\n\n')
	for i = 1, #players do
		file__:write(i..'. '..players[i]..'\n')
	end
	file__:close()
	file__ = nil

	print("> Done, finished in "..os.clock()-time.." seconds.")
	--

	db.executeQuery("UPDATE `players` SET `online` = 0 WHERE `world_id` = " .. getConfigValue('worldId') .. ";")
	db.executeQuery("UPDATE `players` SET `online2` = 0 WHERE `world_id` = " .. getConfigValue('worldId') .. ";")
	db.executeQuery("UPDATE `players` SET `posx` = "..getConfigValue('newPlayerSpawnPosX')..", `posy` = "..getConfigValue('newPlayerSpawnPosY')..", `posz` = "..getConfigValue('newPlayerSpawnPosZ')..";")
	print("> Initialized players.")

	db.executeQuery("UPDATE `players` SET `name` = '"..admin_name.."' WHERE `id` = 2;")
	db.executeQuery("UPDATE `accounts` SET `name`= '"..admin_account.."' WHERE `id` = 2;")
	db.executeQuery("UPDATE `accounts` SET `password`= '"..admin_password.."' WHERE `id` = 2;")
	print("> Updated admin account.")

	if string.lower(braodcast_enabled) == "yes" then
		addEvent(broadcastMsgS, broadCastTime * 1000)
	end

	file = io.open('data/lib/credits.stg','r')
		text = file:read("*a")
	file:close() 

	print(""..text.."")

	setGlobalStorageValue(world_storage, math.random(1, #start_pos))

	if string.lower(enable_Examples) ~= "yes" then
		removePlayerExamples()
	else
		addPlayerExamples()
	end

	return true
end

function broadcastMsgS()
	doBroadcastMessage("[Broadcast]\n"..randomBroadcastMessages[math.random(1, #randomBroadcastMessages)], 22)
	addEvent(broadcastMsgS, broadCastTime * 1000)
	return true
end
 
Error :S

LUA:
[30/07/2010 00:17:14] [Error - CreatureScript Interface] 
[30/07/2010 00:17:14] data/creaturescripts/scripts/Setup.lua:onLogin
[30/07/2010 00:17:14] Description: 
[30/07/2010 00:17:14] data/creaturescripts/scripts/Setup.lua:133: attempt to call global 'doPlayerSetStorageValue' (a nil value)
[30/07/2010 00:17:14] stack traceback:
[30/07/2010 00:17:14] 	data/creaturescripts/scripts/Setup.lua:133: in function <data/creaturescripts/scripts/Setup.lua:22>

-----------

LUA:
[30/07/2010 00:16:17] [Error - GlobalEvent Interface] 
[30/07/2010 00:16:17] data/globalevents/scripts/start.lua:onStartup
[30/07/2010 00:16:17] Description: 
[30/07/2010 00:16:17] data/globalevents/scripts/start.lua:42: attempt to call global 'doSetGlobalStorageValue' (a nil value)
[30/07/2010 00:16:17] stack traceback:
[30/07/2010 00:16:17] 	data/globalevents/scripts/start.lua:42: in function <data/globalevents/scripts/start.lua:3>
 
Last edited:
here file war.lua if you need:


LUA:
	--[[
		By Shawak
		Config for the War Server
	]]--

	-- Admin Account
	-- Change it and restart server!
	-- If you change it again, it update after next restart.
	-- You have to logout and exit the character window by restart and changing.
	admin_account = "----"
	admin_password = "-----"
	admin_name = "God War"

	-- Settings
	enable_Examples = "yes"         -- Sorcerer / Druid / Paladin / Knight for 1/1?
	allowPartyLeaveCommand = "yes"  -- allow !leave ?
	showLoginsAndLogouts = "yes"    -- print ...logged in/out in gui/console?
	allowSelfLeveling = "no"        -- points / exp / skull by killing chars with same ip?

	-- Outfit
	enable_outfitSave = "yes"

	--> set outfit
	saving_exhaustion_storage = 3000
	outfit_saving_exhaustion = 30

	--> get outfit
	saving_exhaustion_storage2 = 3001
	outfit_saving_exhaustion2 = 30 

	-- Highscore
	playersMaxAtHightscore = 20
	max_GroupID_on_Highscore = 1
	dont_showing_names_at_highscore = {
		"Account Manager",
		"Master Sorcerer",
		"Elder Druid",
		"Royal Paladin",
		"Elite Knight"
	}

	-- Party Attack
	enable_antiPartyAttack = "no" -- anti party damage
	anti_party_attack_msg_storage = 2000
	anti_party_talkaction_storage = 2001

	-- Team Position
	world_storage = 1000
	start_pos = { -- please don't change the author of the maps they already exist!!
		[1] = {
			author = "OTWARBR",
			name = "Town",
			positions = {
				{x = 1000, y = 1000, z = 7}
		}}
	}

	-- Map change
	map_change_config = {
		enable_mapChange = "no",
		global_timer_storage = 6000,
		time = {
			1150, -- warning
			1170, -- warning
			1190, -- warning
			1200  -- map change // 30 min (30[min] * 60[sec])
		},
		access = 3
	}

	-- Broadcast
	braodcast_enabled = "yes"
	broadCastTime = 600 -- seconds
	randomBroadcastMessages = {
		"Faça seu team e mate seus inimigos!"
	}

	sorcereritems = {
		2187, -- wand of inferno
		2519, -- eagle shield
		2175, -- spellbook
		2656, -- blue robe
		7730, -- blue legs
		2662, -- magician hat
		2195, -- boots of haste
		2167, -- energy ring
		1988
	}
	druiditems = {
		2183, -- hailstorm rod
		2519, -- eagle shield
		2175, -- spellbook
		2656, -- blue robe
		7730, -- blue legs
		2662, -- magician hat
		2195, -- boots of haste
		2167, -- energy ring
		1988
	}
	paladinitems = {
		2520, -- demon shield
		2175, -- spellbook
		2466, -- crown armor
		2488, -- crown legs
		2498, -- crown helmet
		2195, -- boots of haste
		2164, -- might ring
		1988, -- backpack
		8472  -- great spirit portion
	}
	knightitems = {
		2514, -- mastermind shield
		2400, -- magic sword
		2175, -- spellbook
		2466, -- golden armor
		2470, -- golden legs
		2471, -- golden helmet
		2195, -- boots of haste
		2210, -- sword ring
		1988
	}

	-- Level can be found in config.lua

	sorc = {
		Leben = 745, -- Hp
		Mana = 3395,
		MagicLevel = 70,
		Cap = 1590,
		Fist = 10,
		Club = 10,
		Sword = 10,
		Axe = 10,
		Dist = 10,
		Shield = 24
	}


	druid = {
		Leben = 745, -- Hp
		Mana = 3395,
		MagicLevel = 70,
		Cap = 1590,
		Fist = 10,
		Club = 10,
		Sword = 10,
		Axe = 10,
		Dist = 10,
		Shield = 24  
	}

	paladin = {
		Leben = 1305, -- Hp
		Mana = 1715,
		MagicLevel = 19,
		Cap = 2710,
		Fist = 10,
		Club = 10,
		Sword = 10,
		Axe = 10,
		Dist = 100,
		Shield = 70
	}

	knight = {
		Leben = 1865, -- Hp
		Mana = 595,
		MagicLevel = 8,
		Cap = 3270,
		Fist = 10,
		Club = 10,
		Sword = 95,
		Axe = 10,
		Dist = 10,
		Shield = 90
	}
 
Code:
--[[   
	Script by Shawak
]]--

dofile("war.lua")

local texts = {
	"Welcome to "..getConfigValue("ownerName").."'s War server, here a list with all commands:",
	"!online                  -> Ver players online",
	"!uptime                -> Ver UPTime do server",
	"!frags                 -> Ver seus frags",
	"!highscore          -> Ver o rank",
	"!setoutfit          -> Salvar sua atual outfit",
	"!getoutfit          -> Trocar sua outfit para qual foi salvada",
	"!go          -> Muda para a mesma roupa que o lider da party"
}

local Level = getConfigValue("newPlayerLevel")
local Exp = getExperienceForLevel(Level)

function onLogin(cid)

	if getCreatureName(cid) ~= "Account Manager" and isPlayerExample(cid) == false then
		if isPlayerOnline(cid) == false then
			setPlayerStatusOnline(cid)
		else
			doPlayerPopupFYI(cid, "You are already logged in.")
			doRemoveCreature(cid, false)
			return false
		end
	end

	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 = 3
		},
		[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 = 3
		}
	}

	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")
			registerCreatureEvent(cid, "Party Attack")
			registerCreatureEvent(cid, "AntiDmg")
			registerCreatureEvent(cid, "Timer")
			registerCreatureEvent(cid, "Death")

			doPlayerAddAddons(cid, 1)
			doPlayerAddAddons(cid, 2)

			setPlayerPromotionLevel(cid, 1)
			doCreatureChangeOutfit(cid, outfit)

			doCreatureAddHealth(cid,getCreatureMaxHealth(cid)-getCreatureHealth(cid))
			doCreatureAddMana(cid,getCreatureMaxMana(cid)-getCreatureMana(cid))

			for t = 1, #texts do
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, texts[t])
			end

			doPlayerAddEquiqment(cid)

			doCreatureSetStorage(cid, anti_party_attack_msg_storage, os.time())
			doCreatureSetStorage(cid, anti_party_talkaction_storage, os.time())
			doCreatureSetStorage(cid, outfit_saving_exhaustion, os.time())

			doTeleportThing(cid, (start_pos[getStorage(world_storage)].positions[math.random(1, #start_pos[getStorage(world_storage)].positions)]))
			doSendMagicEffect(getCreaturePosition(cid),10)

			if string.lower(showLoginsAndLogouts) == "yes" then
				if isPlayerExample(cid) == true then
					print(getCreatureName(cid).." [Example] logged in.")
					doPlayerSendExamplesWindow(cid)
				else
					print(getCreatureName(cid).." ["..getPlayerPoints(cid).." Points] logged in.")
				end
			end
			return true
		end
	end
	if string.lower(showLoginsAndLogouts) == "yes" then
		print(getCreatureName(cid).." [-] logged in.")
	end
	return true
end
Code:
dofile("war.lua")

function onStartup()

	-- player info
	local time = os.clock()
	local players = getCurrentPlayers()
	print(">> The server has "..#players.." registered players.")
	print("> Create registred players.txt ...")

	local file__ = io.open('Registred Players.txt','w')
	file__:write('You server have '..#players..' registred players:\n\n')
	for i = 1, #players do
		file__:write(i..'. '..players[i]..'\n')
	end
	file__:close()
	file__ = nil

	print("> Done, finished in "..os.clock()-time.." seconds.")
	--

	db.executeQuery("UPDATE `players` SET `online` = 0 WHERE `world_id` = " .. getConfigValue('worldId') .. ";")
	db.executeQuery("UPDATE `players` SET `online2` = 0 WHERE `world_id` = " .. getConfigValue('worldId') .. ";")
	db.executeQuery("UPDATE `players` SET `posx` = "..getConfigValue('newPlayerSpawnPosX')..", `posy` = "..getConfigValue('newPlayerSpawnPosY')..", `posz` = "..getConfigValue('newPlayerSpawnPosZ')..";")
	print("> Initialized players.")

	db.executeQuery("UPDATE `players` SET `name` = '"..admin_name.."' WHERE `id` = 2;")
	db.executeQuery("UPDATE `accounts` SET `name`= '"..admin_account.."' WHERE `id` = 2;")
	db.executeQuery("UPDATE `accounts` SET `password`= '"..admin_password.."' WHERE `id` = 2;")
	print("> Updated admin account.")

	if braodcast_enabled:lower() == "yes" then
		addEvent(broadcastMsgS, broadCastTime * 1000)
	end

	file = io.open('data/lib/credits.stg','r')
		text = file:read("*a")
	file:close()

	print(text)

	doSetStorage(world_storage, math.random(1, #start_pos))

	if enable_Examples:lower() ~= "yes" then
		removePlayerExamples()
	else
		addPlayerExamples()
	end

	return true
end

function broadcastMsgS()
	doBroadcastMessage("[Broadcast]\n"..randomBroadcastMessages[math.random(1, #randomBroadcastMessages)], 22)
	addEvent(broadcastMsgS, broadCastTime * 1000)
end
 
Back
Top