ABLUA的NetLoopFunction()写一个在线增加离线时间的系统

利用NetLoopFunction()函数写一个增加活力的系统,同理我们可以写一个增加离线时间的系统,这次则教大家让离线时间达到上限便不再增加的方法。

function NetLoopFunction()
	local maxplayer = char.getPlayerMaxNum() - 1
	--判断每2分钟执行一次
	if math.mod(looptimer, 2) == 0 then
		for i = 0, maxplayer do
			if char.check(i) == 1 then
				--判断是否是非离线玩家,0是非离线,大于0则都属于离线状态
				if char.getWorkInt(i,"离线") == 0 then
					--判断当前人物所拥有的离线时间,乘60则是按分钟来增加 小于7200则为7200分钟为上闲
					if char.getInt(i,"离线时间") < 7200 * 60 then
					    --增加1分钟的离线时间
						char.setInt(i,"离线时间",char.getInt(i,"离线时间")+1*60)
					end
				end
			end
		end
	end

	looptimer = looptimer + 1
end

function data()
	looptimer = 0
end
function main()
	data()
end

主要注释我已经注释出来的,石器时代里离线时间增加方式可以有很多种,可以打怪得离线时间,可以用道具增加离线时间,打造一个属于你自己的石器时代,要有多多的想法。

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。