Jump to content
Denis

Admin Panel

Recommended Posts

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

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: http://prntscr.com/2rlwbc

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

  • Love 16

Share this post


Link to post

A normal User can easy use this Panel, too.

 

how? it's being identified by name

Share this post


Link to post

I wrote how you could activate the panel without the specific name, but i dont want that anybody uses it to hurt other servers.

  • Love 2

Share this post


Link to post
Guest

Consider making It more secure then.

Share this post


Link to post

I think with this verification is impossible to "hack"...


        when button or info begin
            if pc.get_name() == "[Admin]Denic" then
                --execute the quest
            else
                say("dont try to hack the quest ")
            end

Regards.

  • Love 1

Share this post


Link to post

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 :: 

Share this post


Link to post

In line 56 is 

"if choise == 1 then "

, shouldnt be intead 

if choiseSecond == 1 then 

Share this post


Link to post

#Updated

It's impossible now to open the menu without specified name

Share this post


Link to post

It works all 2 commands, "CloseClient" and "SendMessage", the "Warn" command isn't work. 

Share this post


Link to post

I've fixed it now,check it and tell me if it'll works

Share this post


Link to post

Yes, now it works ! :D 

 

8SqO7.jpg

 

But if I give me 3 + 1  warnings I don't recive nothing. And here it say [ all time ] I have 0 warning 

 

8SqQY.jpg

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

I don't know..I tested the quest on my test server and it's works fine

Share this post


Link to post
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

Share this post


Link to post
quest denic_cikiec begin
    state start begin
        when login with pc.is_gm() and pc.get_name() == "[Admin]Denic" begin
            send_letter("Admin Panel")
        end

the best :)

 

Share this post


Link to post
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 :: 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.