Informations
Jump to content

Lorem Ipsum...

Click to Dismiss this Notification
Ładowanie danych...

Recommended Posts

spacer.png

 

In this tutorial, we will implement a feature to add a "kick" button in the user interface (UI) that appears only for players whose names start with a specific character, let's say "[". This enhancement is useful for game moderation and could greatly assist admins in managing player behavior.

Implementation Steps

1. Check Player Name Condition

First, we need to ensure the "kick" button appears based on the player's name. The following code snippet checks if the first character of the player's name is "[":

 
This is the hidden content, please

2. Modify uitarget.py

Next, we will need to locate the uitarget.py file and search for localeInfo.TARGET_BUTTON_EMOTION_ALLOW. Below is the snippet you need to find:

 
This is the hidden content, please

Then, just below this line, add the definition for the "kick" button using the following code:

 
This is the hidden content, please

3. Set Up Kick Button Event

Now, locate the following line in the same file:

 
This is the hidden content, please

Insert the kick button event under this line:

 
This is the hidden content, please

4. Update Showing Button List

Next, search for this code:

 
This is the hidden content, please

Under this line, add:

 
This is the hidden content, please

5. Implement Kick Functionality

Finally, scroll down to the def OnUpdate(self): section and add the kick functionality with the following code:

 
This is the hidden content, please

 

With these modifications, a "kick" button will appear in the UI for players whose names start with "[", allowing for easy moderation. This feature adds functionality aimed at improving gameplay experience by keeping the community in check.

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

spacer.png

Disable AdBlock
The popup will be closed in 5 seconds...