AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Kick by timezone (https://forums.alliedmods.net/showthread.php?t=301453)

csykosoma 09-21-2017 16:12

Kick by timezone
 
GeoIP+ (v1.3): https://forums.alliedmods.net/showthread.php?t=95665
Country Kicker: https://forums.alliedmods.net/showthread.php?t=11412


GeoIP 1.3 allows finding players timezone. Could country kicker be changed to timezone kicker? Only allowing a few timezones in the server?

wickedd 09-21-2017 19:58

Re: Kick by timezone
 
Quote:

Originally Posted by csykosoma (Post 2550125)
Could country kicker be changed to timezone kicker? Only allowing a few timezones in the server?

Yes it can, but you will need GeoLite2 City.

A couple of questions
Are you using Amxx 1.8.3?
Do you want time zone or state? I'm asking because of your post in the country kicker thread.

Code:

Time Zone: America/Chicago
State: Louisiana
State ABBREV: US-LA


csykosoma 09-22-2017 07:15

Re: Kick by timezone
 
Hey wickedd!! I am using AMXX 1.8.3, and thanks for asking about by states I think it would be way better.

wickedd 09-22-2017 19:48

Re: Kick by timezone
 
You don't need the GeoIP module since you're using 1.8.3, it's already include. However, you still need GeoLite2 City.
Download the binary and install it in addons/amxmodx/data folder.

Here you go
PHP Code:

#include <amxmodx>
#include <geoip>

new szIPMAX_PLAYERS ][ 16 ], szStatesMAX_PLAYERS ][ 15 ], s_kick
new Trie:s_load

new States[][] =
{    
    
"Texas",
    
"Mississippi"   // Add the states here
}

public 
plugin_init()
{
    
register_plugin"States Kicker""0.1""csykosoma" )
    
s_kick register_cvar"states_kick""1" /* 1 = Kick the states on the list. 2 = Allow only the states from the list*/

    
s_load TrieCreate( )
        
    for( new 
0sizeofStates ); i++ )
    {
        
TrieSetCells_loadStates], )
    }
}

public 
client_authorizedid )
{
    
get_user_ipidszIPid ], charsmaxszIP[] ), )
    
geoip_region_nameszIPid ], szStatesid ], charsmaxszStates[] )  )

    switch( 
get_pcvar_nums_kick ) )
    {
        case 
1:
        {
            if( 
TrieKeyExistss_loadszStatesid ] ) )
            {
                
server_cmd"kick #%i ^"Your State Is Not Allowed^""get_user_useridid ) )
            }
        }
        case 
2:
        {            
            if( !
TrieKeyExistss_loadszStatesid ] ) )
            {
                
server_cmd"kick #%i ^"Your States Is Not Allowed^""get_user_useridid ) )
            }
        }
    }
}

public 
plugin_end( )
{
    
TrieDestroys_load )



csykosoma 09-22-2017 23:39

Re: Kick by timezone
 
Thanks wickedd, could it be changed to whitelist states instead of blocking states?

TheSpaniard 09-23-2017 01:37

Re: Kick by timezone
 
Quote:

Originally Posted by csykosoma (Post 2550348)
Thanks wickedd, could it be changed to whitelist states instead of blocking states?

Add all states except those you want to whitelist.

wickedd 09-23-2017 03:15

Re: Kick by timezone
 
Quote:

Originally Posted by csykosoma (Post 2550348)
Thanks wickedd, could it be changed to whitelist states instead of blocking states?

I edited my previous post

Natsheh 09-23-2017 04:54

Re: Kick by timezone
 
charsmax( szStates[] ) -1
:arrow:
charsmax( szStates[] )

Theres no need for the minus 1 if youre using charsmax

wickedd 09-23-2017 09:56

Re: Kick by timezone
 
Quote:

Originally Posted by Natsheh (Post 2550375)
charsmax( szStates[] ) -1
:arrow:
charsmax( szStates[] )

Theres no need for the minus 1 if youre using charsmax

I know that, that's not the reason why it was there. Thanks for the catch, I forgot to delete it.
Code:

native geoip_region_name(const ip[], result[], len, id = -1)

csykosoma 09-23-2017 18:19

Re: Kick by timezone
 
Wickedd I'm getting some compiling errors, I'm using version AMXX 1.8.3 3918, an older one. Could this be the cause?

Code:

//// skicker22.sma
// C:\Users\Desktop\fresh\addons\amxmodx\scripting\skicker22.sma(4) : error 017: undefined symbol "MAX_PLAYERS"
// C:\Users\Desktop\fresh\addons\amxmodx\scripting\skicker22.sma(29) : error 017: undefined symbol "geoip_region_name"
// C:\Users\Desktop\fresh\addons\amxmodx\scripting\skicker22.sma(29) : error 088: number of arguments does not match definition
//
// 3 Errors.
// Could not locate output file compiled\skicker.amx (compile failed).
//
// Compilation Time: 0.09 sec
// ----------------------------------------



All times are GMT -4. The time now is 00:26.

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