15.11.2015, 19:04
Hi guys,
I'm back with yet another question for all you wonderful scripters to educate me with. So I am working on a system currently that I thought, 'Hey! I'll put a date into the database under this players character, and after two days, if they haven't paid the fines due from that date, then issue a warrant out on that player'.
So I went ahead and produced the system that detected when a player was to be given a fine for speeding by the speed cameras. Then input the date into the database under their character, the date being the day they got issued their fine.
Using the query
Afterwards, it as expected, saved the date in the format of '2015-11-15'. Now obviously this is not my traditional date format, being from the UK we have a tendency to use DD/MM/YYYY however, date formats don't bother me too much as I'm good at working them out.
However, I'm trying to think of a way to tell players that it has been two days since they received their first fine and it should be paid now, so obviously, todays date being in this format 2015-11-15, they would obviously be notified on '2015-11-17'.
I ALWAYS do my best to give a solution of my own to work off as I am not one to expect people to do the work for me. However, the string for this date is 9 characters. Would it just be as simple as searching the string for the last 2 characters (character 8 and 9) and then converting that string to a value and adding two onto it? I hope that makes sense.
Thanks guys.
I'm back with yet another question for all you wonderful scripters to educate me with. So I am working on a system currently that I thought, 'Hey! I'll put a date into the database under this players character, and after two days, if they haven't paid the fines due from that date, then issue a warrant out on that player'.
So I went ahead and produced the system that detected when a player was to be given a fine for speeding by the speed cameras. Then input the date into the database under their character, the date being the day they got issued their fine.
Using the query
PHP код:
if(CharInfo[playerid][FineTotal] == 0)
{
format(query, sizeof(query), "UPDATE `pCharacters` SET FineDue=CURDATE() WHERE cID='%d'", CharInfo[playerid][cID]);
mysql_function_query(dbHandle, query, false, "", "");
}
However, I'm trying to think of a way to tell players that it has been two days since they received their first fine and it should be paid now, so obviously, todays date being in this format 2015-11-15, they would obviously be notified on '2015-11-17'.
I ALWAYS do my best to give a solution of my own to work off as I am not one to expect people to do the work for me. However, the string for this date is 9 characters. Would it just be as simple as searching the string for the last 2 characters (character 8 and 9) and then converting that string to a value and adding two onto it? I hope that makes sense.
Thanks guys.