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

Remove after specific time


Post New Thread Reply   
 
Thread Tools Display Modes
Pewdiepie
Senior Member
Join Date: Oct 2012
Old 10-27-2012 , 16:39   Re: Remove after specific time
Reply With Quote #11

Back to helping please.

Last edited by Pewdiepie; 10-27-2012 at 16:39.
Pewdiepie is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 10-27-2012 , 16:41   Re: Remove after specific time
Reply With Quote #12

Without your code, we can't help you.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Pewdiepie
Senior Member
Join Date: Oct 2012
Old 10-27-2012 , 17:09   Re: Remove after specific time
Reply With Quote #13

Quote:
Originally Posted by YamiKaitou View Post
Without your code, we can't help you.
Why do you think im asking for help? if you readed my post you would probably understand.
Pewdiepie is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 10-27-2012 , 17:14   Re: Remove after specific time
Reply With Quote #14

Quote:
Originally Posted by Pewdiepie View Post
Why do you think im asking for help? if you readed my post you would probably understand.
I did read. How do you expect us to help you if you are not providing the code that is storing the date.

You were shown how to check the current date. To check if 30 days have passed, you simply add the equivalent seconds to your unix timestamp and compare the new timestamp to the current. if the current date is equal or greater than the old, then 30 days have passed
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Pewdiepie
Senior Member
Join Date: Oct 2012
Old 10-27-2012 , 18:36   Re: Remove after specific time
Reply With Quote #15

Quote:
Originally Posted by YamiKaitou View Post
I did read. How do you expect us to help you if you are not providing the code that is storing the date.

You were shown how to check the current date. To check if 30 days have passed, you simply add the equivalent seconds to your unix timestamp and compare the new timestamp to the current. if the current date is equal or greater than the old, then 30 days have passed
That's what I dont get mind giving me an example? Thats what scripting help is for.
Pewdiepie is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-27-2012 , 19:16   Re: Remove after specific time
Reply With Quote #16

Quote:
Originally Posted by Pewdiepie View Post
That's what I dont get mind giving me an example? Thats what scripting help is for.
Post your code and then we can help. All to often we write an example and it's not what is needed.
__________________
fysiks is online now
Pewdiepie
Senior Member
Join Date: Oct 2012
Old 10-27-2012 , 19:22   Re: Remove after specific time
Reply With Quote #17

Quote:
Originally Posted by fysiks View Post
Post your code and then we can help. All to often we write an example and it's not what is needed.
I dont have any code because I dont know how to do it, thats why im asking for help. I googled for like 2 hours by now. And all the time I kept getting the same answers. well on my guess i would go for this?

PHP Code:
public function(id)
{
    new 
Date get_systime()
    new 
Month 2592000
    
    
if (Month Date)
    {
        
// expired
    
}
    else
    {
        
// not expired
    
}

Pewdiepie is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 10-27-2012 , 19:23   Re: Remove after specific time
Reply With Quote #18

Mm I have an automatic admin remover in my server...

Here you have an example:
PHP Code:
// here is the cmd to add admin
public cmd_addexpid )
{
    new 
arg33 ], exp], dias11 ], playerexp2;
    
    
//playername
    
read_argv1argcharsmaxarg ) );
    
    
//not important
    
read_argv2expcharsmaxexp ) );
    
    
//how much days will have vip
    
read_argv3diascharsmaxdias ) );
    
    
remove_quotesarg );
    
remove_quotesexp );
    
remove_quotesdias );
    
    
player cmd_targetidargCMDTARGET_ALLOW_SELF );
    
exp2 str_to_numexp );
    
    
console_printid"exp: %d"exp2 );
    
    if( !
player 
    {
        
console_printid"Nombre invalido" );
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
exp2 || exp2 )
    {
        
console_printid"No se puede dar una experiencia mayor a 5 o menor que 2" );
        return 
PLUGIN_HANDLED;
    }
    
    else
    {
        new 
iDias = ( str_to_numdias ) * 86400 ) + get_systime( );
        
        if( 
iDias )
        {
            
console_printid"Error, inetnte con una menor cantidad de dias" );
            return 
PLUGIN_HANDLED;
        }
        
        
Query"UPDATE %s SET Admin='%d', Vencimiento='%d' WHERE SteamID='%s'"TABLEexp2iDiasAuthIDplayer ] );
        
        
console_printid"Le diste experiencia x%d a %s por %s dias"exp2g_pj_nameplayer ], dias );
        
        
colored_print0"!yLe dieron experiencia !teamx%d !ya !team%s !ypor !team%s !ydias"exp2g_pj_nameplayer ], dias );
        
        
g_adminplayer ] = exp2;
    }
    
    return 
PLUGIN_HANDLED;
}

// g_vencimiento is the number when vip's time will finish. I load it on client_authorized.
if( g_vencimientoid ] > )
    
set_task6.0"show_vencimiento"id+TASK_VENCIMIENTO );
    
public 
show_vencimientotaskid )
    
clcmd_vencimientoID_VENCIMIENTO );
    
public 
clcmd_vencimientoid )
{
    if( 
check_vencimientoid ) )
    {
        
colored_printid"!yTu experiencia se ha vencido. Para renovarla contactate con %s"szContacto );
        return 
PLUGIN_HANDLED;
    }
        
    static 
diashorasminutos;
    
    
dias g_vencimientoid ] / 86400;
    
horas = ( g_vencimientoid ] / 3600 ) % 24;
    
minutos = ( ( g_vencimientoid ] / 60 ) - ( horas 60 ) ) % 60;
    
    
colored_printid"!yTu !teamx%d !yvence en !team%d !ydias !team%d !yhoras!y y !team%d !yminutos."g_adminid ], diashorasminutos );
    
    return 
PLUGIN_HANDLED;
}

bool:check_vencimientoid )
{
    if( 
get_systime( ) > g_vencimientoid ] > // here i check if current time is higher than vip's end date
    
{
        
Query"UPDATE %s SET Vencimiento='0' WHERE SteamID='%s'"TABLEAuthIDid ] );

        
g_vencimientoid ] = 0;
        
        return 
true;
    }
    
    return 
false;

I hoke that helps you.
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 10-27-2012 , 19:29   Re: Remove after specific time
Reply With Quote #19

PHP Code:
if ((timestamp+2592000) <= get_systime())
     
// 30 days has passed
else
    
// 30 days has not passed 
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 10-27-2012 at 19:44.
YamiKaitou is offline
Pewdiepie
Senior Member
Join Date: Oct 2012
Old 10-27-2012 , 19:30   Re: Remove after specific time
Reply With Quote #20

Quote:
Originally Posted by Neeeeeeeeeel.- View Post
Mm I have an automatic admin remover in my server...

Here you have an example:
PHP Code:
// here is the cmd to add admin
public cmd_addexpid )
{
    new 
arg33 ], exp], dias11 ], playerexp2;
    
    
//playername
    
read_argv1argcharsmaxarg ) );
    
    
//not important
    
read_argv2expcharsmaxexp ) );
    
    
//how much days will have vip
    
read_argv3diascharsmaxdias ) );
    
    
remove_quotesarg );
    
remove_quotesexp );
    
remove_quotesdias );
    
    
player cmd_targetidargCMDTARGET_ALLOW_SELF );
    
exp2 str_to_numexp );
    
    
console_printid"exp: %d"exp2 );
    
    if( !
player 
    {
        
console_printid"Nombre invalido" );
        return 
PLUGIN_HANDLED;
    }
    
    else if( 
exp2 || exp2 )
    {
        
console_printid"No se puede dar una experiencia mayor a 5 o menor que 2" );
        return 
PLUGIN_HANDLED;
    }
    
    else
    {
        new 
iDias = ( str_to_numdias ) * 86400 ) + get_systime( );
        
        if( 
iDias )
        {
            
console_printid"Error, inetnte con una menor cantidad de dias" );
            return 
PLUGIN_HANDLED;
        }
        
        
Query"UPDATE %s SET Admin='%d', Vencimiento='%d' WHERE SteamID='%s'"TABLEexp2iDiasAuthIDplayer ] );
        
        
console_printid"Le diste experiencia x%d a %s por %s dias"exp2g_pj_nameplayer ], dias );
        
        
colored_print0"!yLe dieron experiencia !teamx%d !ya !team%s !ypor !team%s !ydias"exp2g_pj_nameplayer ], dias );
        
        
g_adminplayer ] = exp2;
    }
    
    return 
PLUGIN_HANDLED;
}

// g_vencimiento is the number when vip's time will finish. I load it on client_authorized.
if( g_vencimientoid ] > )
    
set_task6.0"show_vencimiento"id+TASK_VENCIMIENTO );
    
public 
show_vencimientotaskid )
    
clcmd_vencimientoID_VENCIMIENTO );
    
public 
clcmd_vencimientoid )
{
    if( 
check_vencimientoid ) )
    {
        
colored_printid"!yTu experiencia se ha vencido. Para renovarla contactate con %s"szContacto );
        return 
PLUGIN_HANDLED;
    }
        
    static 
diashorasminutos;
    
    
dias g_vencimientoid ] / 86400;
    
horas = ( g_vencimientoid ] / 3600 ) % 24;
    
minutos = ( ( g_vencimientoid ] / 60 ) - ( horas 60 ) ) % 60;
    
    
colored_printid"!yTu !teamx%d !yvence en !team%d !ydias !team%d !yhoras!y y !team%d !yminutos."g_adminid ], diashorasminutos );
    
    return 
PLUGIN_HANDLED;
}

bool:check_vencimientoid )
{
    if( 
get_systime( ) > g_vencimientoid ] > // here i check if current time is higher than vip's end date
    
{
        
Query"UPDATE %s SET Vencimiento='0' WHERE SteamID='%s'"TABLEAuthIDid ] );

        
g_vencimientoid ] = 0;
        
        return 
true;
    }
    
    return 
false;

I hoke that helps you.
Thanks for the example, but I still dont get what get_systime() does
I know it gets the time since 00:00:00 1st january 1970. But what does that even mean?
Pewdiepie 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:30.


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