13.03.2018, 22:41
Hi guys
I'm using timestamp for Prison Time.For example,when i put player in prison:
//time is minutes
It's all fine.But i have "problem" when i want to save it.(I'm find way to do it,but i'm sure that here have better way to do it)
I can't save it as timestamp,i need to convert it into seconds.My code(i think it's bad idea so..)
Why I'm make check if(PlayerInfo[playerid][Prison] > 10000000 ).Because when player is not in Prison he have Prison = 0 .(So without this check it will be 0-gettime() and it's -252522525
When Player log in game:
PlayerInfo[playerid][Prison] = (PlayerInfo[playerid][Prison] + gettime());
It all works good,but my question is better way to do this..Because i don't have idea
Thank you(sorry for English)
I'm using timestamp for Prison Time.For example,when i put player in prison:
//time is minutes
Код:
PlayerInfo[ID][Prison] = (gettime() +time*60);
I can't save it as timestamp,i need to convert it into seconds.My code(i think it's bad idea so..)
Код:
if(PlayerInfo[playerid][Prison] > 1000000) { format(szQuery, sizeof(szQuery), "UPDATE `accounts` SET `Prison`='%i' WHERE `ID`='%i'", PlayerInfo[playerid][Prison]-gettime(),PlayerInfo[playerid][dbID]); mysql_tquery(g_SQL, szQuery); } else { format(szQuery, sizeof(szQuery), "UPDATE `accounts` SET `Prison`='%i' WHERE `ID`='%i'", PlayerInfo[playerid][Prison],PlayerInfo[playerid][dbID]); mysql_tquery(g_SQL, szQuery); }
When Player log in game:
PlayerInfo[playerid][Prison] = (PlayerInfo[playerid][Prison] + gettime());
It all works good,but my question is better way to do this..Because i don't have idea
Thank you(sorry for English)