Doesn't work, tried to create another table in MySQL database such as time and time2, still don't load my time. Even tho, it saves correctly on my database from phpmyadmin, I can see the exact same time saved. But struggle on loading it.
This is the command:
PHP код:
CMD:settime(playerid, params[])
{
if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
new str[50], time, query[250];
if(sscanf(params, "i", time)) return SendClientMessage(playerid, -1, "{c3c3c3}/settime [time]");
if(time < 0 || time > 50)
{
SendClientMessage(playerid, -1, "{c3c3c3}/settime [time]");
return 1;
}
SetPlayerTime(playerid, time, time);
format(str, sizeof(str), "{c3c3c3}(time) Time set to %d", time);
SendClientMessage(playerid, -1, str);
mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `time` = '%d' WHERE `id` = '%d' LIMIT 1", time, pInfo[playerid][ID]);
mysql_tquery(g_SQL, query);
mysql_format(g_SQL, query, sizeof query, "UPDATE `players` SET `time2` = '0' WHERE `id` = '%d' LIMIT 1", time, pInfo[playerid][ID]);
mysql_tquery(g_SQL, query);
return 1;
}
I made time2 = minutes to set it to 0, because I don't care about minutes. I want to make it simply as that, no need to add additional numbers while changing own time.
PHP код:
stock LoadTime(playerid){
cache_get_value_int(0, "time", pInfo[playerid][Time]);
cache_get_value_int(0, "time2", pInfo[playerid][Time2]);
SetPlayerTime(playerid,pInfo[playerid][Time], pInfo[playerid][Time2]);
return 1;}
Something wrong there...