Jump to content

Admin Panel


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Today i'll show you one ban panel that i have created with python & lua

NOTE:For this quest you will need Mijago's Quest Library!

 

Library

Spoiler

quest denic_cikiec begin
    state start begin
        when login with pc.get_name() == "[Admin]Denic" begin
            send_letter("Admin Panel")
        end
        when button or info begin
            if pc.get_name() == "[Admin]Denic" then
                say_title("Admin Panel")
                say("Please select an option:")
                local a = select("Close Client", "Warning", "Send Message", "Cancel")
                if a == 1 then
                    say_title("Admin Panel - Close Client")
                    say("Please enter the players name in the field.")
                    local player_name = input()
                    local u_vid = find_pc_by_name(player_name)
                    if player_name == "" then
                        say_title("Admin Panel")
                        say("You have not enter the player's name!")
                        return
                    end
                    
                    if u_vid == 0 then
                        say_title("Admin Panel")
                        say_reward(string.format("The player: %s is not connected! ", player_name))
                    else
                        local old = pc.select(u_vid)
                        cmdchat("CloseClient "..player_name.."")
                        pc.select(old)
                    end
                end
                if a == 2 then
                    say_title("Admin Panel - Warning/Ban")
                    say_reward('If one player have already 3 warnings and you give him another one warning,')
                    say_reward('his account will be banned permanent!')                
                    say("Please enter the players name in the field.")        
                    local player_name = input()
                    local get_warnings = pc.getqf(player_name..'Warning')
                    local u_vid = find_pc_by_name(player_name)
                    if player_name == "" then
                        say_title("Admin Panel")
                        say("You have not enter the player's name!")
                        return
                    end
                    
                    if u_vid == 0 then
                        say_title("Admin Panel")
                        say_reward(string.format("The player: %s is not connected! ", player_name))
                    else
                        say(string.format("The player: %s has %s warnings! ", player_name,get_warnings))
                        if get_warnings == 3 then
                            say_reward(string.format('If you give this warning now the player: %s will be banned permanent!',player_name))
                        end
                        local choiseSecond = select('Continue','Cancel')
                        if choiseSecond == 2 then
                            return
                        end
                        if choiseSecond == 1 then        
                            if get_warnings >= 3 then
                                local a = mysql_query("SELECT * FROM player.player WHERE name='"..player_name.."'")
                                local acc_id = a.account_id[1]
                                mysql_query("UPDATE account.account SET status='BLOCK' WHERE id='"..acc_id.."'")
                                command('dc '..player_name)
                            end
                            if get_warnings < 3 then
                                local old = pc.select(u_vid)
                                cmdchat("Warn "..player_name.."")
                                pc.select(old)
                                pc.setqf(player_name..'Warning',get_warnings+1)
                            end
                        end
                    end
                end
                            
                if a == 3 then
                    say_title("Admin Panel")
                    say("Enter the message you want with - and not spaces, (ex. Hello-World)")    
                    say("Please enter the players name in the field.")    
                    local player_name = input()
                    local message = input()
                    local u_vid = find_pc_by_name(player_name)
                    if player_name == "" then
                        say_title("Admin Panel")
                        say("You have not enter the player's name!")
                        return
                    end
                    
                    if u_vid == 0 then
                        say_title("Admin Panel")
                        say_reward(string.format("The player: %s is not connected! ", player_name))
                    else
                        local old = pc.select(u_vid)
                        cmdchat("SendMessage "..player_name.." "..message.."")
                        pc.select(old)
                    end
                end
            end
        end
    end
end

After adding this quest to your server open game.py (root file)

 

and search for string servercommandlist=

you will see something like this: https://metin2.download/picture/aX2pwr71T7PLRjAhaj9k10sTTDmB7lY4/.png

go to the end of functions and add:

            "CloseClient"        : self.CloseClient,
            "Warn"                : self.Warning,
            "SendMessage"        : self.Message,           

and after adding them add these to the end of file:

	def CloseClient(self, player_name):
		if player_name == str(player.GetName()):
			import dbg,app
			dbg.LogBox("One GM has close your client!",'Client')
			app.Exit()
		
		
	def Warning(self, player_name):
		if player_name == str(player.GetName()):
			import os
			os.system("@echo off && title Warning && color 0a && echo You have take a warning in 3 warnings you get a permanent ban && pause")

	def Message(self, player_name, text):
		if player_name == str(player.GetName()):
			message = text.replace("-"," ")
			import dbg
			dbg.LogBox(message)
			
			

and then test the quest

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 30
  • Not Good 1
  • Confused 1
  • Scream 2
  • Good 11
  • Love 3
  • Love 35
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Hello, i have one problem and one question: First, where can i find Mijago's Quest Library? And the problme: When i'm in login scrn i get this error in syser(client):

0515 23:19:36399 :: Traceback (most recent call last):

0515 23:19:36399 :: File "networkModule.py", line 237, in SetGamePhase 0515 23:19:36399 :: File "system.py", line 130, in __pack_import

0515 23:19:36399 :: File " 0515 23:19:36399 :: game.py

0515 23:19:36399 :: ", line

0515 23:19:36399 :: 2243

0515 23:19:36399 ::

0515 23:19:36399 ::

0515 23:19:36399 :: if player_name == str(player.GetName()):

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36400 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 ::

0515 23:19:36401 :: IndentationError

0515 23:19:36411 :: :

0515 23:19:36411 :: unindent does not match any outer indentation level

0515 23:19:36411 :: 

Link to comment
Share on other sites

  • 2 weeks later...
  • Management

Hi 

 

I tested this quest, but when I give 3 warnings at one player, the account who is blocked is the mine, but the other client take DC

 

Can you fix this to ban the other player and not the mine???

 

Thanks

raw

raw

Link to comment
Share on other sites

  • Management

still not work :S

 

the account who is blocked was mine

 

EDIT: now it's banning the correct account, but when I give the last warning I can't login again in the server with the account I used to warning, just rebooting the server I can login again :S

raw

raw

Link to comment
Share on other sites

  • 3 months later...
  • Silver
quest denic_cikiec begin
    state start begin
        when login with pc.get_name() == "[Admin]Denic" begin
            send_letter("Admin Panel")
        end
        when button or info begin
            if pc.get_name() == "[Admin]Denic" then
		when login with pc.is_gm() begin
			send_letter("Admin Panel")
		end
		when button or info begin
			if pc.is_gm() then

now is better because get_name easily bypass as clientside

Link to comment
Share on other sites

  • 6 months later...
0325 09:49:24018 :: Traceback (most recent call last):
 
0325 09:49:24316 ::   File "networkModule.py", line 239, in SetGamePhase
 
0325 09:49:24350 ::   File "system.py", line 130, in __pack_import
 
0325 09:49:24350 ::   File "
0325 09:49:24350 :: <string>
0325 09:49:24350 :: ", line 
0325 09:49:24350 :: 2138
0325 09:49:24350 :: 
 
0325 09:49:24350 ::     
0325 09:49:24350 :: if player_name == str(player.GetName()):
 
0325 09:49:24350 ::     
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24350 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 ::  
0325 09:49:24351 :: ^
 
0325 09:49:24351 :: IndentationError
0325 09:49:24351 :: : 
0325 09:49:24351 :: unindent does not match any outer indentation level
0325 09:49:24351 :: 
Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / 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.