29.09.2018, 22:31
(
Последний раз редактировалось akaDragonu; 30.09.2018 в 12:15.
)
Hello, my name is Denis.
I'm asking for help with a 3-day timer for example.
I'm making a faction raport automatically, for each player(member of a faction).
I put `RaportTimer[playerid]`on OnGameModeInit, and `KillTimer(RaportTimer[playerid])` on OnGameModeExit:
OnGameModeInit:
OnGameModeExit:
1. Do I have to put on OnPlayerConnect? I think not..
2. The "CheckRaport" lines:
I also created a test order, but no results:
Help me with this problem please!! I have no idea how can I make the timer go?
Explication for this system:
When a player enter any faction, he has 7 days to complete the faction raport. When raport timer is gone, if he does not have the completed raport, he will automatically receive an uninvite to rank 1 / rank up automatically, to rank 2+ receive a warning / rank automatically.
I hope I understand, I'm waiting for your answer. Peace!
I'm asking for help with a 3-day timer for example.
I'm making a faction raport automatically, for each player(member of a faction).
I put `RaportTimer[playerid]`on OnGameModeInit, and `KillTimer(RaportTimer[playerid])` on OnGameModeExit:
OnGameModeInit:
PHP код:
foreach(new player: Player) if(PlayerInfo[player][FactionID] >= 1 && PlayerInfo[player][FactionRank] >= 1) {
RaportTimer[player] = SetTimerEx("CheckRaport", 1000, true, "i", player);
}
PHP код:
foreach(new player: Player) if(PlayerInfo[player][FactionID] >= 1 && PlayerInfo[player][FactionRank] >= 1) {
KillTimer(RaportTimer[player]);
}
2. The "CheckRaport" lines:
PHP код:
public CheckRaport(playerid)
{
new faction = PlayerInfo[playerid][FactionID], rank = PlayerInfo[playerid][FactionRank], query[256], string[256], date[256], name[30], leader[30], result[256], whorankedup[256], whorankedid, day,month,year,h,mi,s; getdate(year,month,day); gettime(h,mi,s);
format(query, sizeof(query), "SELECT * FROM `users` WHERE `name` = '%s' AND `FactionID` >= 1", GPlayerName(playerid));
new Cache:check = mysql_query(SQL, query); for(new i, j = cache_get_row_count(); i != j; ++i)
{
new resetdate[128]; format(resetdate, 128, "%s", getdate(year,month,day));
cache_get_field_content(i, "ResetRaportDate", result); format(date, 256, result);
if(strcmp(resetdate, date, true) == 0)
{
PHP код:
CMD:resetraport(playerid, params[])
{
new player, string[256], query[256], d,m,y,h,mi,s; getdate(y,m,d); gettime(h,mi,s);
if(PlayerInfo[playerid][AdminLevel] >= 6)
{
if(sscanf(params, "u", player)) return SendClientMessage(playerid, COLOR_TEAL, "Usage: {CECECE}/resetraport <player id>");
if(PlayerInfo[player][FactionID] >= 1 && PlayerInfo[player][FactionRank] <= 6)
{
format(string, sizeof(string), "Administrator %s reseted %s faction raport.", GPlayerName(playerid), GPlayerName(player)), SendMessageToAdmins(DarkNiceRed, string);
mysql_format(SQL, query, sizeof(query), "UPDATE `users` SET `ResetRaportDate` = '30-09-2018 00:30:00', `FactionRaport1` = '0', `FactionRaport2` = '0' AND `FactionRaport3` = '0' WHERE `name` = '%s'", d, m, y, h, mi, s, GPlayerName(player)); mysql_tquery(SQL, query, "", "");
PlayerInfo[player][ResetDateYear] = y; PlayerInfo[player][ResetDateMonth] = m; PlayerInfo[player][ResetDateDay] = d; return 1;
}
else return SendClientMessage(playerid, Grey, "This player doesn't have a faction!");
}
else return 0;
}
Explication for this system:
When a player enter any faction, he has 7 days to complete the faction raport. When raport timer is gone, if he does not have the completed raport, he will automatically receive an uninvite to rank 1 / rank up automatically, to rank 2+ receive a warning / rank automatically.
I hope I understand, I'm waiting for your answer. Peace!