How to make expire system
#1

Here clan_cashreward is activated and need to expire it after 4 days how can it set;
there is an variable in (MYSQL) Clan_CashReward_End

PHP код:
                new Query[300];
                new 
cashreward;
                new 
cashrewardexpire;
                
mysql_format(gSQL,Querysizeof(Query), "SELECT * FROM `Clans` WHERE `ID` = '%d'",GetPlayerClanId(playerid));
                
mysql_query(gSQLQuery );
                
cache_get_value_int(0"Clan_CashReward",cashreward);
                
cache_get_value_int(0"Clan_CashReward_End"cashrewardexpire);
                if(
cashreward == 0)
                {
                    new 
yearmonthdayDate[12];
                    
getdate(yearmonthday);
                    
format(Date12"%02d/%02d/%d"daymonthyear);
                    
mysql_format(gSQL,Querysizeof(Query), "UPDATE `Clans` SET `Clan_CashReward` = '1' WHERE `ID` = '%d'",GetPlayerClanId(playerid));
                    
mysql_query(gSQLQuery );
                    
mysql_format(gSQL,Querysizeof(Query), "UPDATE `Clans` SET `Clan_CashReward_Start` = '%s' WHERE `ID` = '%d'",Date,GetPlayerClanId(playerid));
                    
mysql_query(gSQLQuery );
                }
                else
                {
                    
SendClientMessage(playerid,-1,"{FF0000}ERROR: Its Already Activated!");
                } 
Reply
#2

Some one plz help me over here @
Reply
#3

Check using Date functions in MySQL that if 4 days are over or not. save a date along with your other data.

I dont know what kind of system is it.. tell us more precise I might able to help you more
Reply
#4

Unix Timestamps
Reply
#5

Is it possible to store data and time together in my SQL ?....
I want to get set the cashrewardexpire value to 4 day's from start.. if i activate it today 24/01/2018, 8:06
it should end automatically on 28/01/2018, 8:06..
Is it possible ?
Reply
#6

Using Time Stamp with number variables.

Example:

Quote:

new YourVariable;

// Stored Date
YourVariable = gettime() + 25200 +3600;
// 25200 is a fix number to get it sync real time
// 3600 is the expired time, change it to the expired time you want (https://sampforum.blast.hk/showthread.php?tid=254915%5D)

// Check
if(gettime() > YourVariable) // Expried
{
// Do something here
}

Reply
#7

I got to show the remaining time too how could it done like: 2days 4 hours 30 min remaining
Reply
#8

https://sampforum.blast.hk/showthread.php?tid=347605
Reply
#9

You could use a General Listener aswell.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)