Jump to content
Sign in to follow this  
OldHero

How to solve feed

Recommended Posts

Prevent a player on entering those maps if they have the pet food or fruit or whatever.

 

Go to entry.lua and add the code under the function "function check_can_enter_garner2( role, copy_mgr )"

local Num_1 = CheckBagItem(role, ITEM_ID)
If Num_1 >= 1 then
	SystemNotice(role, "Please remove [ITEM_NAME] from your inventory to enter.")
	return 0
end

 

Share this post


Link to post
Share on other sites

You also can put a small check for character map in functions of these items in ItemEffect.lua 


Share this post


Link to post
Share on other sites

he means, by putting the check inside the item function.

prohibmap = { garner2 = true, vod = true }
if prohibmap[GetChaMpaName(role)] then
UseItemFailed(role)
return
end

Also, try putting the signatures of fruit item function into a table,
and loop through the table and hooking it using _G
not necessarily needed but may help you decrease the time to add the checks to each fruit.


kong.png

a2.png

Share this post


Link to post
Share on other sites

@OldHero

Let's take Fairy Ration (ID 227) for example. Its function in ItemEffect.lua is ItemUse_SiLiao

function ItemUse_SiLiao(role, Item, Item_Traget)
	
	local Cha_Boat = 0
	Cha_Boat = GetCtrlBoat(role)
	if Cha_Boat ~= nil then 
		SystemNotice(role, "Cannot use while sailing") 
		UseItemFailed(role) 
		return 
	end      
		
	local Item_Traget_URE = GetItemAttr(Item_Traget, ITEMATTR_URE)
	local Item_Traget_MAXURE = GetItemAttr(Item_Traget, ITEMATTR_MAXURE)
	local Item_type = GetItemType(Item)
	local Item_Traget_Type = GetItemType(Item_Traget)
	local Num = 2500

	if Item_type == 57 and Item_Traget_Type == 59 then
		if Item_Traget_URE < Item_Traget_MAXURE then
			Give_ElfURE (role, Item_Traget, Num)
		else
			SystemNotice(role, "Fairy is full") 
			UseItemFailed(role)
			return
		end
	end 
end

Then you can get character's map using GetChaMapName() function and make a small check:

function ItemUse_SiLiao(role, Item, Item_Traget)
	
	local Cha_Boat = 0
	Cha_Boat = GetCtrlBoat(role)
	if Cha_Boat ~= nil then 
		SystemNotice(role, "Cannot use while sailing") 
		UseItemFailed(role) 
		return 
	end      
		
		
	-- Our check for map
	local map_name = GetChaMapName(role)
	if map_name == "garner2" then
		SystemNotice(role, "You can't use this item in Chaos Argent!") 
		UseItemFailed(role)
		return
	end
		
		
	local Item_Traget_URE = GetItemAttr(Item_Traget, ITEMATTR_URE)
	local Item_Traget_MAXURE = GetItemAttr(Item_Traget, ITEMATTR_MAXURE)
	local Item_type = GetItemType(Item)
	local Item_Traget_Type = GetItemType(Item_Traget)
	local Num = 2500

	if Item_type == 57 and Item_Traget_Type == 59 then
		if Item_Traget_URE < Item_Traget_MAXURE then
			Give_ElfURE (role, Item_Traget, Num)
		else
			SystemNotice(role, "Fairy is full") 
			UseItemFailed(role)
			return
		end
	end 
	
end

Now players can't feed fairies in Chaos Argent.

 

@KONG your code has a typo: GetChaMpaName => GetChaMapName

  • Like 1

Share this post


Link to post
Share on other sites

I think he means feed as in boosting score by killing alts, not feed as in fairy fruits.

 

Main issue you will have is working out if thy are actually boosting, or of its just a coincidence that the same person keeps looking the same person.

One solution is just adding a cool down if the same person kills the same person too many times, but his is not perfect.

You might be able to set up a SQL trigger to write cha I'd and IP/MAC to a file on row update, and then check on kill, but the issue is Mac can be changed in login packet and IP by proxy

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...