插入玩家命令chartalkfunction.lua(ablua)

  • A+
所属分类:LUA脚本
function getIntPart(x)
    if x <= 0 then
       return math.ceil(x);
    end

    if math.ceil(x) == x then
       x = math.ceil(x);
    else
       x = math.ceil(x) - 1;
    end
    return x;
end

function CharTalkFunction( charaindex, message, color)
  jnd = getIntPart(char.getInt(charaindex, "技能点"))
	field = other.getString(message, " ", 1)
	if field == "/WD" then
		if sasql.getVipPoint(charaindex) >= 10 then
			char.talkToServer(-1, "[世界]" .. char.getChar(charaindex, "名字") .. ":" .. other.getString(message, " ", 2), color)
			sasql.setVipPoint(charaindex, sasql.getVipPoint(charaindex) - 10)
				char.TalkToCli(charaindex, -1, "发言成功,扣除10点会员点!", "红色")
		else
			char.TalkToCli(charaindex, -1, "您的会员点目前少于10,无法使用世界频道!", "红色")
		end
		return 1
	elseif field == "/FM" then
		if sasql.getVipPoint(charaindex) >= 10 then
			char.talkToServer(-1, "[世界]" .. char.getChar(charaindex, "名字") .. ":" .. other.getString(message, " ", 2), color)
			sasql.setVipPoint(charaindex, sasql.getVipPoint(charaindex) - 10)
				char.TalkToCli(charaindex, -1, "发言成功,扣除10点会员点!", "红色")
		else
			char.TalkToCli(charaindex, -1, "您的会员点目前少于10,无法使用世界频道!", "红色")
		end
		return 1
	end
	if field == "/EM" then
	itemindex = char.Additem(charaindex, 20172)
					if itemindex > -1 then
										char.TalkToCli(charaindex, -1, "恭喜你,成功制作恶魔宝石", "黄色")
										item.setInt(itemindex, "等级" , 1)
										item.setInt(itemindex, "次数" , 100)
										item.setChar(itemindex, "说明", "使用後可原地遇敌            使用次数100次")
										item.UpdataItemOne(charaindex, itemindex)
					else
										char.TalkToCli(charaindex, -1, "身上的道具已满了!!!", "黄色")

					end
					end
	if field == "/加力量" then		
	  num = other.atoi(other.getString(message, " ", 2))
    		if num > jnd or num < 0  then
		        char.TalkToCli(charaindex, -1, "对不起,你没有这么多点数可加哦", "黄色")
		        return 1
		    else
		        char.setInt(charaindex, "技能点" ,char.getInt(charaindex, "技能点") - num)
	 	        char.setInt(charaindex, "腕力" , char.getInt(charaindex, "腕力") + num * 100)
	 	        char.TalkToCli(charaindex, -1, "恭喜你,加点成功!", "黄色")
	 	        return 1
		    end
	end
		if field == "/加防御" then
		    num = other.atoi(other.getString(message, " ", 2))
				if num > jnd or num < 0  then
		       char.TalkToCli(charaindex, -1, "对不起,你没有这么多点数可加哦", "黄色")
		       return 1
		    else
			     char.setInt(charaindex, "技能点" ,char.getInt(charaindex, "技能点") - num)
	 	       char.setInt(charaindex, "耐力" , char.getInt(charaindex, "耐力") + num * 100)
	 	       char.TalkToCli(charaindex, -1, "恭喜你,加点成功!", "黄色")
		       return 1
		    end
		end	
		if field == "/加敏捷" then
		       num = other.atoi(other.getString(message, " ", 2))		
			if num > jnd or num < 0 then
		       char.TalkToCli(charaindex, -1, "对不起,你没有这么多点数可加哦", "黄色")
					 return 1
			else
					 char.setInt(charaindex, "技能点" ,char.getInt(charaindex, "技能点") - num)
	 	       char.setInt(charaindex, "速度" , char.getInt(charaindex, "速度") + num * 100)
	 	       char.TalkToCli(charaindex, -1, "恭喜你,加点成功!", "黄色")
	 	 			 return 1
		  end
		end
			if field == "/加体力" then
				num = other.atoi(other.getString(message, " ", 2))		
				if num > jnd or num < 0 then
					char.TalkToCli(charaindex, -1, "对不起,你没有这么多点数可加哦", "黄色")
					return 1
				else
					char.setInt(charaindex, "技能点" ,char.getInt(charaindex, "技能点") - num)
	 	 			char.setInt(charaindex, "体力" , char.getInt(charaindex, "体力") + num * 100)
	 	 		  char.TalkToCli(charaindex, -1, "恭喜你,加点成功!", "黄色")
	 	 			return 1
				end
		 end
			if field == "/加魅力" then
				char.setInt(charaindex, "魅力", 100)
				char.TalkToCli(charaindex, -1, "恭喜你,你又重新变的漂亮啦", "黄色")
        return 1
			end
			if field == "/加忠诚" then
			num = other.atoi(other.getString(message, " ", 2))		
					if num > 100 or num < -100 then
						char.TalkToCli(charaindex, -1, "对不起,不可能加这么多或减这么多忠", "黄色")
						return 1
					else
							itemindex = char.Additem(charaindex, 2566)
							if itemindex > -1 then
								if num > 0 then
										item.setChar(itemindex, 3, "忠" .. num)
										char.TalkToCli(charaindex, -1, "恭喜你,你已经成功制作忠诚药!忠" .. num, "黄色")
										item.setChar(itemindex, "说明", "你制定的加忠药加"..  num .. "忠,制作者:" .. char.getChar(charaindex, "名字"))
										item.UpdataItemOne(charaindex, itemindex)
								elseif num < 0 then
										item.setChar(itemindex, 3, "忠 " .. num)		  
										char.TalkToCli(charaindex, -1, "恭喜你,你已经成功制作忠诚药!忠" .. num, "黄色")
										item.setChar(itemindex, "说明", "你制定的减忠药减".. - num .. "忠,制作者:" .. char.getChar(charaindex, "名字"))
										item.UpdataItemOne(charaindex, itemindex)
								elseif num == 0 then
										num = 100	
										item.setChar(itemindex, 3, "忠" .. num)
										char.TalkToCli(charaindex, -1, "恭喜你,你已经成功制作忠诚药!忠" .. num, "黄色")
										item.setChar(itemindex, "说明", "你制定的加忠药加"..  num .. "忠,制作者:" .. char.getChar(charaindex, "名字"))
										item.UpdataItemOne(charaindex, itemindex)
										end
          else
					char.TalkToCli(charaindex, -1, "身上的道具已满了!!!", "黄色")
					end
		end
		return 1
		end
		
		if field == "/lx" then
				if char.getInt(charaindex, "声望") >= 5000 then
						if char.getInt(charaindex, "地图号") == 2000 then
								if char.getWorkChar(charaindex, "摆摊") ~= "" then
									
									char.setInt(charaindex, "声望", char.getInt(charaindex, "声望") - 5000) 
								  char.TalkToCli(charaindex, -1, "离线设定已成功,请安心退出游戏", "黄色")
 									char.setWorkInt(charaindex, "离线", 1);
	                fd = char.getFd(charaindex)
									net.endOne(fd)
								else
									char.TalkToCli(charaindex, -1, "对不起,请摆摊后离线", "黄色")	
								end	
						else
									char.TalkToCli(charaindex, -1, "对不起,目前只支持在鱼村离线", "黄色")
						end
				else		
				char.TalkToCli(charaindex, -1, "对不起,您的声望不够!一次需要50声望哦!", "黄色")		
				end
		return 1
		end		
		if field == "/查询" then
		maxplayer = char.getPlayerMaxNum()
		offlinenum = 0
		for i = 0, maxplayer - 1 do
		if char.check(i) == 1 then
			if char.getWorkInt(i, "离线") ==  1 then
				offlinenum = offlinenum + 1
			end
		end
		end
		char.TalkToCli(charaindex, -1, "当前系统时间为:" .. other.time() .. "[单位秒],建议不要交易限时宠物,你的离线时间剩余:" .. char.getInt(charaindex, "进化") .. "秒 当前离系统极限离线人数为" .. 200 - offlinenum, "红色")
		for i = 0, 4 do
		 petindex = char.getCharPet(charaindex, i) 
			if char.check(petindex) == 1 then
				field = other.getString(char.getChar(petindex,"名字"), "]", 1)
				time = other.atoi(other.getString(char.getChar(petindex,"名字"), "]", 2))
						if field == "[限时" or field == "*[限" then
							if time < other.time() then
								char.DelPet(charaindex, petindex)
								char.TalkToCli(charaindex, -1, "对不起,您的宠物已到期" , "青色")
								else
								char.TalkToCli(charaindex, -1, "第" .. i +1 .. "位宠剩余时间" .. (time - other.time()) / 3600 .. "小时", "青色")
							end
						
						end
			end
		end
		return 1
end
		if field == "/绑定"  then
			num = other.getString(message, " ", 2)
			for i = 0, 4 do
		  petindex = char.getCharPet(charaindex, i) 
			if char.check(petindex) == 1 then
				xs = other.getString(char.getChar(petindex,"名字"), "]", 1)
			
				
				field = other.getString(char.getChar(petindex,"名字"), "新", 1)
				newname = other.getString(char.getChar(petindex,"名字"), "[绑定]", 1)
				if field ~= "*" and newname ~= "*" and xs ~= "[限时" and xs ~= "*[限" then
				 char.setChar(petindex, "名字", "*[绑定]" .. char.getChar(petindex, "名字"))
				 char.setChar( petindex, "主人名字",num)
				 char.sendStatusString(charaindex, "K" .. i)
				else 
				char.TalkToCli(charaindex, -1, "第"..i + 1 .."位宠不可绑定" , "红色")
				end
			end
			end	
	return 1
	end
	if field == "/解绑"  then
			num = other.getString(message, " ", 2)
			for i = 0, 4 do
		  petindex = char.getCharPet(charaindex, i) 
			if char.check(petindex) == 1 then
				
				newname = other.getString(char.getChar(petindex,"名字"), "[绑定]", 1)
				oldname = other.getString(char.getChar(petindex,"名字"), "[绑定]", 2)
				if newname == "*"then
				  if num == char.getChar( petindex, "主人名字") then
				  	char.setChar(petindex, "名字", oldname)
				  	char.setChar( petindex, "主人名字",char.getChar( charaindex, "名字"))
				  	char.TalkToCli(charaindex, -1, "第"..i + 1 .."位宠解绑成功!" , "青色")
				  	char.sendStatusString(charaindex, "K" .. i)
				  else
				  	char.TalkToCli(charaindex, -1, "第"..i + 1 .."位宠密码错误!" , "红色")
				  end
				else 
				char.TalkToCli(charaindex, -1, "第"..i + 1 .."位宠不可解绑!" , "红色")
				end
			end
			end	
	return 1
	end
	if field == "/增时" then
	
	if char.getInt(charaindex, "积分") > 100 then		
		num = getIntPart(other.atoi(other.getString(message, " ", 2)))
		 num = num - 1
		petindex = char.getCharPet(charaindex, num) 
		if char.check(petindex) == 1 then
			message = char.getChar(petindex, "名字")
			xs = other.getString(message, "]", 1)
			time = other.atoi(other.getString(message, "]", 2))
			if xs == "[限时" or xs == "*[限" then
				if time < other.time() then
						char.DelPet(charaindex, petindex)
						char.TalkToCli(charaindex, -1, "对不起,您的宠物已到期" , "红色")
						return 1
				else
						if num > -1 and num < 5 then
						 
							time = time + 86400
							char.setChar(petindex, "名字", "*[限]" .. time )
			
							char.sendStatusString(charaindex, "K" .. num)
							char.TalkToCli(charaindex, -1, "时间已上升1天" .. "且自动绑定" .. ",你的可激活时间为" .. (char.getInt(charaindex, "积分") - 100) / 100 .. "天", "黄色")
							char.setInt(charaindex, "积分", char.getInt(charaindex, "积分") - 100)
							return 1
						else 
							char.TalkToCli(charaindex, -1, "对不起,请输入1-5位,以外挂为准" , "红色")
							return 1
						end 
				end	
		 else
				char.TalkToCli(charaindex, -1, "对不起,请确定是限时宠!" , "红色")
				return 1
  	 end
		 
		end
	end
	end	
return 0
end

function data()
	worldpay = 5000000
	worldfmpay = 1000000
end

function main()
	data()
end

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin

发表评论

您必须才能发表评论!