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

Plugin work by time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Caypen
New Member
Join Date: Nov 2017
Old 11-19-2017 , 05:54   Plugin work by time
Reply With Quote #1

Hello, I want to make the plugins work on time, I have a kernel of plug-ins. It remains to make a function that will shut down the plug-in if the expiration date has expired

there is an example, but it is for AMXMODX https://forums.alliedmods.net/showthread.php?t=235864

Sorry for my english. I am a pseudo-Russian coder

Last edited by Caypen; 11-19-2017 at 06:03.
Caypen is offline
xFlane
AlliedModders Donor
Join Date: Nov 2017
Location: Israel
Old 11-19-2017 , 09:33   Re: Plugin work by time
Reply With Quote #2

this method is not really protecting something because changing the server time will bypass it,
but anyway.

PHP Code:
UsagecheckForTimeLicense( { 29112017 }, "The plugin is no longer valid." ); // Plugin is valid until the 29/11/2017. ( inside OnPluginStart ). 
PHP Code:
stock void checkForTimeLicense(int[] time, const char[] Error)
{
    
int timeNum GetTime();
    
char times[3][5]; 
    
    
FormatTime(times[0], 5"%d"timeNum); // day
    
FormatTime(times[1], 5"%m"timeNum); // month
    
FormatTime(times[2], 5"%Y"timeNum); // year
    
    
int timesf time[0] + time[1] * 30 time[2] * 365;
    
timeNum StringToInt(times[0]) + StringToInt(times[1]) * 30 StringToInt(times[2]) * 365;
    
    if( 
timesf timeNum )
    {
        
SetFailState(Error);
    }

xFlane is offline
Caypen
New Member
Join Date: Nov 2017
Old 11-19-2017 , 11:13   Re: Plugin work by time
Reply With Quote #3

Quote:
Originally Posted by xFlane View Post
this method is not really protecting something because changing the server time will bypass it,
but anyway.

PHP Code:
UsagecheckForTimeLicense( { 29112017 }, "The plugin is no longer valid." ); // Plugin is valid until the 29/11/2017. ( inside OnPluginStart ). 
PHP Code:
stock void checkForTimeLicense(int[] time, const char[] Error)
{
    
int timeNum GetTime();
    
char times[3][5]; 
    
    
FormatTime(times[0], 5"%d"timeNum); // day
    
FormatTime(times[1], 5"%m"timeNum); // month
    
FormatTime(times[2], 5"%Y"timeNum); // year
    
    
int timesf time[0] + time[1] * 30 time[2] * 365;
    
timeNum StringToInt(times[0]) + StringToInt(times[1]) * 30 StringToInt(times[2]) * 365;
    
    if( 
timesf timeNum )
    {
        
SetFailState(Error);
    }

Thanks for the example, did a little differently. I made an active binding to the database, the plugin is attached to the kernel, the kernel sends a request for the validity of the date, if the date is not valid, cancels the launch
Caypen 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 15:31.


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