Raised This Month: $ Target: $400
 0% 

Kick by timezone


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
csykosoma
Member
Join Date: Dec 2011
Old 09-21-2017 , 16:12   Kick by timezone
Reply With Quote #1

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?
csykosoma is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-21-2017 , 19:58   Re: Kick by timezone
Reply With Quote #2

Quote:
Originally Posted by csykosoma View Post
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
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 09-21-2017 at 20:03.
wickedd is offline
csykosoma
Member
Join Date: Dec 2011
Old 09-22-2017 , 07:15   Re: Kick by timezone
Reply With Quote #3

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

Last edited by csykosoma; 09-22-2017 at 07:34.
csykosoma is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-22-2017 , 19:48   Re: Kick by timezone
Reply With Quote #4

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 )

__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 09-23-2017 at 09:52.
wickedd is offline
csykosoma
Member
Join Date: Dec 2011
Old 09-22-2017 , 23:39   Re: Kick by timezone
Reply With Quote #5

Thanks wickedd, could it be changed to whitelist states instead of blocking states?
csykosoma is offline
TheSpaniard
Senior Member
Join Date: Jul 2017
Location: Hell
Old 09-23-2017 , 01:37   Re: Kick by timezone
Reply With Quote #6

Quote:
Originally Posted by csykosoma View Post
Thanks wickedd, could it be changed to whitelist states instead of blocking states?
Add all states except those you want to whitelist.
__________________
And I Am Back.
TheSpaniard is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-23-2017 , 03:15   Re: Kick by timezone
Reply With Quote #7

Quote:
Originally Posted by csykosoma View Post
Thanks wickedd, could it be changed to whitelist states instead of blocking states?
I edited my previous post
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-23-2017 , 04:54   Re: Kick by timezone
Reply With Quote #8

charsmax( szStates[] ) -1

charsmax( szStates[] )

Theres no need for the minus 1 if youre using charsmax
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-23-2017 , 09:56   Re: Kick by timezone
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
charsmax( szStates[] ) -1

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)
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
csykosoma
Member
Join Date: Dec 2011
Old 09-23-2017 , 18:19   Re: Kick by timezone
Reply With Quote #10

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

Last edited by csykosoma; 09-23-2017 at 18:20.
csykosoma is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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