AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Anti base air in base builder mod (https://forums.alliedmods.net/showthread.php?t=302943)

VINAGHOST 11-17-2017 07:09

Anti base air in base builder mod
 
Hello ._.
In my server, people always build "air base" which is close to the top of the map.
I want to prevent them by detecting their origin ang check it is too close the top map and I will teleport them to spawn point.
But I can't find any code about get origin of the top of map, can someone give me one ?

This is my code :
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <hamsandwich>
#include <basebuilder>

#define PLUGIN "BB: Anti base air"
#define VERSION "1.0"
#define AUTHOR "VINAGHOST"

new anti[33]
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""ham_Spawn_post"1)
}
public 
ham_Spawn_post(id)
{
    if(!
is_user_alive(id))
        
ExecuteHam(Ham_Spawnid)
    else
    {
        if(!
bb_is_user_zombie(id)) anti[id] = true
        anti
[id] = false
    
}
}    
        
public 
client_PostThink(id)
{
    if( 
anti[id] )
    {
        new 
origin[3], dist
        get_user_origin
(idorigin)
        
// how to dectect player if they near the top of the map ?
        
        
if( /*they near the top of the map*/)
        {
            
ExecuteHam(Ham_Spawnid)
            
client_print(idprint_chat"Air base not allowed)
        }
    }


Thanks ._. and I know my admin can spawn them manually but if they offline who do this ?

siriusmd99 11-17-2017 10:33

Re: Anti base air in base builder mod
 
I think it's a bad way to teleport players who are close to the top of the map. If you add blocks properly then zombies (or whatever) will be able reach you.
If you want to punish properly for aircamp then you have to create an algorithm to detect if player is reachable by the zombies. For example checking distance between blocks so that it won't exceed the player jump distance's limit. Also you have to measure the block size to be sure that zombies will be able to jump on it. If it's too tall then they won't be able to jump on the block and then it will be considered aircamp.

But I don't think it's that simple to build such algorithm because there can be tricks to avoid punishment for example if you join two blocks edge by edge than algorithm will say its OK but in reality zombies won't be able to jump on that because there will be no edge to climb on. Maybe there are other methods that don't require distance and view checking, if someone has an idea then you are good to go on.

VINAGHOST 11-20-2017 07:46

Re: Anti base air in base builder mod
 
Quote:

Originally Posted by siriusmd99 (Post 2561018)
If it's too tall then they won't be able to jump on the block and then it will be considered aircamp.

I don't think base that zombies cant jump is aircamp because layer, tunnel can make them cant jump.
But those base is quite hard to build or need to many player for building it so I allow them but air camp is very easy to build but very hard to defeat ._.

Anyone can help me, please ".'

siriusmd99 11-20-2017 08:25

Re: Anti base air in base builder mod
 
Wait a minute. There is actually solution for this. There is a cvar
bb_preptime "30"
This will set prepare time and after players build their bases they will be respawned to spawn points and they will have 30 seconds to reach their bases.

This way if someone tries to make aircamp they will fail because they won't be able to get to their base.
Just activate the cvar by setting your amount of seconds.

bb_preptime "30" // 30 seconds to reach the base

VINAGHOST 11-21-2017 01:15

Re: Anti base air in base builder mod
 
Quote:

Originally Posted by siriusmd99 (Post 2561667)
Wait a minute. There is actually solution for this. There is a cvar
bb_preptime "30"
This will set prepare time and after players build their bases they will be respawned to spawn points and they will have 30 seconds to reach their bases.

This way if someone tries to make aircamp they will fail because they won't be able to get to their base.
Just activate the cvar by setting your amount of seconds.

bb_preptime "30" // 30 seconds to reach the base

but in some maps zom spawn far from human base so human may go to their base when prepare time is off and if I decrease time, many people build their base may not have enough time to go to their base.

actually, I used this before but players don't like it so I have to find another way ._.

siriusmd99 11-21-2017 01:32

Re: Anti base air in base builder mod
 
Another way is too hard and you will never get even half of what you want. If spawns are far then increase prepare time or run only well designed maps. I had a BB server and I never heard players complaining about insuficient prepare time.
I guess that they are complaining because they build wrong bases and they can't get into it. I had the same issue but they got used after a time.

TheWhitesmith 11-21-2017 12:48

Re: Anti base air in base builder mod
 
I dont think there is a way, simply enable prepare time so that players can't build impossible bases.
You said sometimes players do not have time to reach their base, give them speed in preptime (not much speed so they wont use surf tricks to go to unreachable bases).
Maybe this will help you, maybe it wont.


All times are GMT -4. The time now is 09:05.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.