• 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!

[function request] doSetWorldType(type)

ntmr

hi!
Senator
Joined
Jul 7, 2007
Messages
1,835
Reaction score
15
Location
Santa Catarina, Brazil
Hello all.

A function like that [doSetWorldType(type)] will be good so we can make scripts that change the worldtype (non-pvp, pvp, pvp-e) automaticaly during the day.

Example: From 06AM to 01PM the server is non-pvp, from 01PM to 09PM the server is pvp and from 09PM to 06AM the server is pvp-e.

A function like getWorldType() will help on the scripts too.

I know that isn't very hard to do, because the command /pvp is already done on the trunk, so they only need to make a Lua function with this :)
 
Outfit Lua sistem of the SVN :) on login.lua (i belive it's simple cause just have the functions at the soucers)

login.lua
Code:
local maleOutfits = {132, 133, 134, 143, 144, 145, 146}
local femaleOutfits = {140, 141, 142, 147, 148, 149, 150}
local freeMaleOutfits = {128, 129, 130, 131}
local freeFemOutfits = {136, 137, 138, 139}
local questOutfits = {151, 152, 153, 154, 155, 156, 157, 158, 251, 252, 268, 269, 270, 273, 278, 279}

local function canPlayerWearPremiumOutfits(cid)
	local list = {}
	if(getPlayerSex(cid) == 0) then --0 is female
		list = femaleOutfits
	else
		list = maleOutfits
	end

	local notHas = false
	for _, outfit in ipairs(list) do
		if(canPlayerWearOutfit(cid, outfit, 0) == FALSE) then
			notHas = true
			break
		end
	end

	return not(notHas)
end

local function doPlayerAddPremOutfits(cid)
	local list = {}
	if(getPlayerSex(cid) == 0) then --0 is female
		list = femaleOutfits
	else
		list = maleOutfits
	end

	for _, outfit in ipairs(list) do
		doPlayerAddOutfit(cid, outfit, 0)
	end
end

local function doPlayerRemPremOutfits(cid)
	local list = {}
	local freeList = {}
	if(getPlayerSex(cid) == 0) then --0 is female
		list = femaleOutfits
		freeList = freeFemOutfits
	else
		list = maleOutfits
		freeList = freeMaleOutfits
	end

	for _, outfit in ipairs(list) do
		doPlayerRemOutfit(cid, outfit, 255) --255 means remove looktype
	end

	--Remove free addons
	for _, outfit in ipairs(freeList) do
		doPlayerRemOutfit(cid, outfit, 3) --3 means only addons
	end

	--Remove quest outfits
	for _, outfit in ipairs(questOutfits) do
		if(canPlayerWearOutfit(cid, outfit, 0) == TRUE) then
			doPlayerRemOutfit(cid, outfit, 255)
		end
	end
end

function onLogin(cid)
	if(isPremium(cid) == TRUE) then
		if not(canPlayerWearPremiumOutfits(cid)) then
			doPlayerAddPremOutfits(cid)
			--Check for addons/outfits and add them
			--Remember that you need to set an storage value for the quest outfits/addons
		end

		if(getPlayerStorageValue(cid, 15000) == 1 and getPlayerVocation(cid) <= 4) then
			doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
			setPlayerStorageValue(cid, 15000, -1)
		end
		return TRUE
	end

	--Remove premium privileges
	if(canPlayerWearPremiumOutfits(cid)) then
		doPlayerRemPremOutfits(cid)

		local lookType = 128
		if(getPlayerSex(cid) == 0) then
			lookType = 136
		end
		doCreatureChangeOutfit(cid, {lookType = lookType, lookHead = 78, lookBody = 69, lookLegs = 97, lookFeet = 95, lookAddons = 0})
	end
     -- other codes...
	return TRUE
and outfit.xml
Code:
<outfits>
<!-- Female outfits -->
<outfit type="0" looktype="136" enabled="1" name="Citizen"/>
<outfit type="0" looktype="137" enabled="1" name="Hunter"/>
<outfit type="0" looktype="138" enabled="1" name="Mage"/>
<outfit type="0" looktype="139" enabled="1" name="Knight"/>
<outfit type="0" looktype="140" enabled="0" name="Noblewoman"/>
<outfit type="0" looktype="141" enabled="0" name="Summoner"/>
<outfit type="0" looktype="142" enabled="0" name="Warrior"/>
<outfit type="0" looktype="147" enabled="0" name="Barbarian"/>
<outfit type="0" looktype="148" enabled="0" name="Druid"/>
<outfit type="0" looktype="149" enabled="0" name="Wizard"/>
<outfit type="0" looktype="150" enabled="0" name="Oriental"/>
<outfit type="0" looktype="155" enabled="0" name="Pirate"/>
<outfit type="0" looktype="156" enabled="0" name="Assassin"/>
<outfit type="0" looktype="157" enabled="0" name="Beggar"/>
<outfit type="0" looktype="158" enabled="0" name="Shaman"/>
<outfit type="0" looktype="252" enabled="0" name="Norsewoman"/>
<outfit type="0" looktype="269" enabled="0" name="Nightmare"/>
<outfit type="0" looktype="270" enabled="0" name="Jester"/>
<outfit type="0" looktype="279" enabled="0" name="Brotherhood"/>
<!-- Male outfits -->
<outfit type="1" looktype="128" enabled="1" name="Citizen"/>
<outfit type="1" looktype="129" enabled="1" name="Hunter"/>
<outfit type="1" looktype="130" enabled="1" name="Mage"/>
<outfit type="1" looktype="131" enabled="1" name="Knight"/>
<outfit type="1" looktype="132" enabled="0" name="Nobleman"/>
<outfit type="1" looktype="133" enabled="0" name="Summoner"/>
<outfit type="1" looktype="134" enabled="0" name="Warrior"/>
<outfit type="1" looktype="143" enabled="0" name="Barbarian"/>
<outfit type="1" looktype="144" enabled="0" name="Druid"/>
<outfit type="1" looktype="145" enabled="0" name="Wizard"/>
<outfit type="1" looktype="146" enabled="0" name="Oriental"/>
<outfit type="1" looktype="151" enabled="0" name="Pirate"/>
<outfit type="1" looktype="152" enabled="0" name="Assassin"/>
<outfit type="1" looktype="153" enabled="0" name="Beggar"/>
<outfit type="1" looktype="154" enabled="0" name="Shaman"/>
<outfit type="1" looktype="251" enabled="0" name="Norseman"/>
<outfit type="1" looktype="268" enabled="0" name="Nightmare"/>
<outfit type="1" looktype="273" enabled="0" name="Jester"/>
<outfit type="1" looktype="278" enabled="0" name="Brotherhood"/>
<!-- Archdemon -->
<outfit type="2" looktype="12" enabled="1" name="Archdemon"/>
<!-- Elf outfits -->
<outfit type="2" looktype="159" enabled="1" name="Elf"/>
<!-- Dwarf outfits -->
<outfit type="2" looktype="160" enabled="1" name="Dwarf"/>
<!-- Frog outfits -->
<outfit type="2" looktype="226" enabled="1" name="Frog"/>
<!-- Cult -->
<outfit type="2" looktype="194" enabled="1" name="Cult"/>
<!-- Barbarians -->
<outfit type="2" looktype="253" enabled="1" name="Headsplitter"/>
<outfit type="2" looktype="254" enabled="1" name="Skullhunter"/>
<outfit type="2" looktype="255" enabled="1" name="Bloodwalker"/>
<outfit type="2" looktype="264" enabled="1" name="Brutetamer"/>
<!-- GM Outfits -->
<outfit type="0" looktype="75" enabled="0" name="Gamemaster"/>
<outfit type="0" looktype="266" enabled="0" name="Com. Manager"/>
</outfits>
 
Back
Top