G
giannis196
Guest
hello everyone!!
so, i tried to make a daily reward system where if the gets 1000000 points daily once a day when the game starts and notice the day changed
here is my code in load game script:
and here is my code on savegame script:
it loads and saves successfully but the daily bonus doesn't work.
btw the int64(current_day); i also tried it with string(current_day); first which it didn't worked either.
so, i tried to make a daily reward system where if the gets 1000000 points daily once a day when the game starts and notice the day changed
here is my code in load game script:
GML:
function scr_loadgame(){
if (file_exists("User.sav"))
{
ini_open("User.sav")
global.date = ini_read_real("Save1", "date", 0);
global.month = ini_read_real("Save1", "month", 0);
global.year = ini_read_real("Save1", "year", 0);
show_message(int64(global.year));
global.Money = ini_read_real("Save1", "Money", 0);
global.efficiency = ini_read_real("Save1", "efficiency", 5);
global.speed = ini_read_real("Save1", "speed", 50);
global.off = ini_read_real("Save1", "off", 1);
if(global.year > int64(current_year))
{
global.Money += 100000000;
global.year = int64(current_year);
global.month = int64(current_month);
global.date = int64(current_day);
show_message("you have been awarded with 100000000 money for your today login");
}
if(global.month > int64(current_month))
{
global.Money += 100000000;
global.year = int64(current_year);
global.month = int64(current_month);
global.date = int64(current_day);
show_message("you have been awarded with 100000000 money for your today login");
}
if(global.date > int64(current_day))
{
global.Money += 100000000;
global.year = int64(current_year);
global.month = int64(current_month);
global.date = int64(current_day);
show_message("you have been awarded with 100000000 money for your today login");
}
}else{
global.Money = 0;
global.efficiency = 5;
global.speed = 50;
global.off = 1;
global.date = int64(current_day);
global.month = int64(current_month);
global.year = int64(current_year);
}
}
ini_close();
and here is my code on savegame script:
GML:
// Script assets have changed for v2.3.0 see
// https://help.yoyogames.com/hc/en-us/articles/360005277377 for more information
function scr_savegame(){
if(file_exists("User.sav")) file_delete("User.sav");
ini_open("User.sav")
ini_write_real("Save1","Money", global.Money);
ini_write_real("Save1","efficiency", global.efficiency);
ini_write_real("Save1","speed", global.speed);
ini_write_real("Save1","off", global.off);
ini_write_real("Save1", "date", global.date);
ini_write_real("Save1", "month", global.month);
ini_write_real("Save1", "year", global.year);
ini_close();
}
btw the int64(current_day); i also tried it with string(current_day); first which it didn't worked either.