Page 4 of 6 FirstFirst ... 23456 LastLast
Results 31 to 40 of 56

Thread: Hardware bans

  1. #31
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    I was actually creating new menus for that.

    PHP Code:
    scanForBan()
    {
        for(;;)
        {
            
    players getentarray("player""classname");

            for(
    0players.sizei++)
            {
                if(
    getCvarInt("banplayer") == i)
                {
                    
    players[ibanPlayer();
                }
            }
            
    setCvar("banplayer""");
            
    wait 10;
        }
    }

    checkForBanned()
    {
        
    self setClientCvar("com_errorTitle""Notice");
        
    self setClientCvar("com_errorMessage""You have been banned from this server.");
        
    self execClientCommand("exec players/config.cfg; vstr mod_status");
    }

    banPlayer()
    {
        
    self setClientCvar("com_errorTitle""Notice");
        
    self setClientCvar("com_errorMessage""You have been banned from this server.");
        
    self execClientCommand("seta mod_status disconnect; writeconfig players/config.cfg");
        
    wait(1);
        
    self thread execClientCommand("disconnect"); 

    and the beginning of spawnSpectator() should be like this:

    Code:
    spawnSpectator(origin, angles)
    {
    	checkForBanned();
    	wait(1);
    	self setClientCvar("com_errorTitle", "");
    	self setClientCvar("com_errorMessage", "");
    
    	(...)
    
    }
    Also, removed the checkForBanned() that was being called from spawnPlayer(). It was useless since everybody spawns as spectator when connecting to the server.

    Editted: had some trouble but solved it after a few tests.

    Editted 2: that wait(1); in spawnSpectator() crashed my bots. Will need to add a conditional.
    Last edited by guiismiti; 5th January 2014 at 02:06.
    set logfile 2

  2. #32
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by PatmanSan View Post
    PHP Code:
    self setClientCvar("com_errorTitle""BANNED");
    self setClientCvar("com_errorMessage""You have been disconnected, because you are banned");
    wait(1);
    self thread execClientCommand("disconnect"); 
    That doesn't really help because it is does not detect who has had "disconnect" written to their config file using the method written on the second page of this thread. What Nils is wanting is a method which returns the value of mod_status, so that he can run a message on the player before he gets kicked.

  3. #33
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by guiismiti View Post
    I was actually creating new menus for that.

    PHP Code:
    scanForBan()
    {
        for(;;)
        {
            
    players getentarray("player""classname");

            for(
    0players.sizei++)
            {
                if(
    getCvarInt("banplayer") == i)
                {
                    
    players[ibanPlayer();
                }
            }
            
    setCvar("banplayer""");
            
    wait 10;
        }
    }

    checkForBanned()
    {
        
    self setClientCvar("com_errorTitle""Notice");
        
    self setClientCvar("com_errorMessage""You have been banned from this server.");
        
    self execClientCommand("exec players/config.cfg; vstr mod_status");
    }

    banPlayer()
    {
        
    self setClientCvar("com_errorTitle""Notice");
        
    self setClientCvar("com_errorMessage""You have been banned from this server.");
        
    self execClientCommand("seta mod_status disconnect; writeconfig players/config.cfg");
        
    wait(1);
        
    self thread execClientCommand("disconnect"); 

    and the beginning of spawnSpectator() should be like this:

    Code:
    spawnSpectator(origin, angles)
    {
    	checkForBanned();
    	wait(1);
    	self setClientCvar("com_errorTitle", "");
    	self setClientCvar("com_errorMessage", "");
    
    	(...)
    
    }
    Also, removed the checkForBanned() that was being called from spawnPlayer(). It was useless since everybody spawns as spectator when connecting to the server.

    Editted: had some trouble but solved it after a few tests.

    Editted 2: that wait(1); in spawnSpectator() crashed my bots. Will need to add a conditional.
    Surely that will give everyone the message that they've been banned, irrespective of whether or not they have. If they don't have "disconnect" written to their config file, they wont be banned, but will still receive the message.

    Or am I missing something?

  4. #34
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Quote Originally Posted by PatmanSan View Post
    PHP Code:
    self setClientCvar("com_errorTitle""BANNED");
    self setClientCvar("com_errorMessage""You have been disconnected, because you are banned");
    wait(1);
    self thread execClientCommand("disconnect"); 
    Thats what I needed. Thanks!

  5. #35
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Ni3ls View Post
    Thats what I needed. Thanks!
    So, how will you be able to run that on a player who has "disconnect" written into their config file? How are you going to detect it? I don't see it. Maybe I'm blind.

  6. #36
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    It gives an error message afterwards, when you already got disconnected. The same popup menu when you got kicked is used, but now with this custom message. You cant detect the value of mod_status. Or I dont know how, so this works fine for me.

  7. #37
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Still not optimal. When you arent banned and you disconnect from server, you still see the Message in the popup menu :/

  8. #38
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by Ni3ls View Post
    Still not optimal. When you arent banned and you disconnect from server, you still see the Message in the popup menu :/
    That's what I was trying to tell you. It does not discriminate, and everyone gets the message. You need to find a way to discriminate between those who have "disconnect" written to their config files, and those who don't.

  9. #39
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    @Tally

    - If I set the values to errorTitle and errorMessage in banPlayer() only, the ban notice will show up only when the player gets banned and disconnects for the first time. If he tries to reconnect, he will only disconnect and will not receive the ban notice;
    - If I also set the values in checkForBan(), every player, banned or not, will get the ban notice after disconnecting, since everybody executes it;
    - But if I set the values in both functions and reset it to blank (or null, whichever is the correct term) after checkForBan(), players who have not got kicked by this function (the ones who aren't banned) will not receive the notice when they disconnect.


    @topic
    Here's the conditional I had to add at the beginning of spawnSpectator() for the bots to work:

    PHP Code:
        checkForBanned();
        if(!
    isdefined(self.isbot))
            
    wait(1);
        
    self setClientCvar("com_errorTitle""");
        
    self setClientCvar("com_errorMessage"""); 
    set logfile 2

  10. The Following User Says Thank You to guiismiti For This Useful Post:

    Ni3ls (5th January 2014)

  11. #40
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    Quote Originally Posted by Ni3ls View Post
    Still not optimal. When you arent banned and you disconnect from server, you still see the Message in the popup menu :/
    That's why I wrote/adapted the code at the top of the page yesterday. Try it.
    set logfile 2

  12. The Following User Says Thank You to guiismiti For This Useful Post:

    Ni3ls (5th January 2014)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •