Raised This Month: $51 Target: $400
 12% 

[REQ] Play Time


Post New Thread Reply   
 
Thread Tools Display Modes
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 10-09-2017 , 12:47   Re: [REQ] Play Time
Reply With Quote #21

Cause when server shuts down the playtime for all players resets.
khashayar007 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-09-2017 , 17:29   Re: [REQ] Play Time
Reply With Quote #22

The play time should never reset.
__________________
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-09-2017 , 21:49   Re: [REQ] Play Time
Reply With Quote #23

Made a small fix where the previous players play time would be given to the next player if the player has never been to the server before.
__________________
Bugsy is offline
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 10-10-2017 , 16:15   Re: [REQ] Play Time
Reply With Quote #24

How to remove a player if it's vip? So the player must play again to be vip.
khashayar007 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-10-2017 , 17:31   Re: [REQ] Play Time
Reply With Quote #25

I can add a command for that, too.
__________________
Bugsy is offline
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 10-12-2017 , 15:47   Re: [REQ] Play Time
Reply With Quote #26

Ok add it.
khashayar007 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-20-2017 , 23:21   Re: [REQ] Play Time
Reply With Quote #27

Added blacklist and remove commands. Untested.

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <nvault>

new const Version[] = "0.2";

#define MAX_PLAYERS 32

const FortyEightHours = ( 86400 );

enum PlayerData
{
    
pdAuthID34 ],
    
pdConnectTime,
    
pdPlayTime,
    
pdIgnorePlayer
}

new 
g_pdDataMAX_PLAYERS ][ PlayerData ];
new 
g_Vault;

public 
plugin_init() 
{
    
register_plugin"Play Time VIP" Version "bugsy" );

    
register_clcmd"ptv_blacklist" "Blacklist" );
    
register_clcmd"ptv_removevip" "RemoveVIP" );
    
    
g_Vault nvault_open"ptvip" );
}

public 
plugin_end() 
{
    
nvault_closeg_Vault );
}

public 
client_authorizedid )
{
    new 
szTime11 ] , iTS szMsg48 ];
    
    if ( !( 
g_pdDataid ][ pdIgnorePlayer ] = ( is_user_botid ) || is_user_hltvid ) ) ) )
    {
        
get_user_authidid g_pdDataid ][ pdAuthID ] , charsmaxg_pdData[][ pdAuthID ] ) );
        
        
g_pdDataid ][ pdConnectTime ] = get_systime();
        
        if ( 
nvault_lookupg_Vault g_pdDataid ][ pdAuthID ] , szTime charsmaxszTime ) , iTS ) )
        {
            
g_pdDataid ][ pdPlayTime ] = str_to_numszTime );
            
            if ( 
g_pdDataid ][ pdPlayTime ] != -)
            {
                if ( 
g_pdDataid ][ pdPlayTime ] >= FortyEightHours )
                {
                    
set_user_flagsid ADMIN_LEVEL_F );
                    
                    
formatexszMsg charsmaxszMsg ) , "You have played for %d seconds and now have VIP" g_pdDataid ][ pdPlayTime ] );
                }
                else
                {
                    
formatexszMsg charsmaxszMsg ) , "You have played for %d seconds. Play more to get VIP" g_pdDataid ][ pdPlayTime ] );
                }
            }
        }
        else
        {
            
copyszMsg charsmaxszMsg ) , "This is your first time connecting." );
        }
        
        
set_task8.0 "ShowMessage" id , .parameter=szMsg , .len=sizeofszMsg ) );
    }
}

public 
client_disconnectid )
{
    new 
szTime11 ];
    
    if ( !
g_pdDataid ][ pdIgnorePlayer ] && ( g_pdDataid ][ pdPlayTime ] != -) )
    {
        
num_to_strg_pdDataid ][ pdPlayTime ] + ( get_systime() - g_pdDataid ][ pdConnectTime ] ) , szTime charsmaxszTime ) );
        
nvault_setg_Vault g_pdDataid ][ pdAuthID ] , szTime );
        
g_pdDataid ][ pdPlayTime ] = 0;
    }
}

public 
ShowMessageszMsg[] , id )
{
    if ( 
is_user_connectedid ) )
    {
        
client_printid print_chat szMsg );
    }
}

public 
Blacklistid )
{
    new 
szPlayer32 ] , iPlayer szBlacklist[] = "-1";
    
    
read_argvszPlayer charsmaxszPlayer ) );
    
    if ( ( 
iPlayer cmd_targetid szPlayer ) ) )
    {
        
nvault_psetg_Vault g_pdDataiPlayer ][ pdAuthID ] , szBlacklist );
        
remove_user_flagsiPlayer ADMIN_LEVEL_F );
        
client_printiPlayer print_chat "* You have been blacklisted from getting VIP." );
    }
    
    return 
PLUGIN_HANDLED;
}

public 
RemoveVIPid )
{
    new 
szPlayer32 ] , iPlayer;
    
    
read_argvszPlayer charsmaxszPlayer ) );
    
    if ( ( 
iPlayer cmd_targetid szPlayer ) ) )
    {
        
nvault_removeg_Vault g_pdDataiPlayer ][ pdAuthID ] );
        
remove_user_flagsiPlayer ADMIN_LEVEL_F );
        
client_printiPlayer print_chat "* Your VIP status has been removed." );
    } 
    
    return 
PLUGIN_HANDLED;

__________________
Bugsy is offline
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 10-24-2017 , 11:46   Re: [REQ] Play Time
Reply With Quote #28

Thank you so much It's working. But I need to see who is in vip list so that I can remove it. Can you make a menu for ptv_removevip that shows all vips thus I can delete the vip I want.
khashayar007 is offline
khashayar007
Senior Member
Join Date: Jan 2015
Location: Macedonia
Old 01-06-2018 , 14:41   Re: [REQ] Play Time
Reply With Quote #29

Bugsy can you please add a feature when a player becomes vip after 48 hours remove it's vip.
khashayar007 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-07-2018 , 14:30   Re: [REQ] Play Time
Reply With Quote #30

Quote:
Originally Posted by khashayar007 View Post
Thank you so much It's working. But I need to see who is in vip list so that I can remove it. Can you make a menu for ptv_removevip that shows all vips thus I can delete the vip I want.
This will require that you use the nvault_array include which requires that all servers running this have either a amxmodx dev build running or have the fixed nvault module installed.

Quote:
Originally Posted by khashayar007 View Post
Bugsy can you please add a feature when a player becomes vip after 48 hours remove it's vip.
I don't understand this request.
__________________
Bugsy 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 03:53.


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