SA-MP Forums Archive
I have a problem! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I have a problem! (/showthread.php?tid=659310)



I have a problem! - akaDragonu - 29.09.2018

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:
PHP код:
foreach(new playerPlayer) if(PlayerInfo[player][FactionID] >= && PlayerInfo[player][FactionRank] >= 1) {
        
RaportTimer[player]     = SetTimerEx("CheckRaport"1000true"i"player);
        } 
OnGameModeExit:
PHP код:
foreach(new playerPlayer) if(PlayerInfo[player][FactionID] >= && PlayerInfo[player][FactionRank] >= 1) {
        
KillTimer(RaportTimer[player]);
    } 
1. Do I have to put on OnPlayerConnect? I think not..
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], whorankedidday,month,year,h,mi,sgetdate(year,month,day); gettime(h,mi,s);
    
format(querysizeof(query), "SELECT * FROM `users` WHERE `name` = '%s' AND `FactionID` >= 1"GPlayerName(playerid));
    new 
Cache:check mysql_query(SQLquery); for(new icache_get_row_count(); != j; ++i)
    {
        new 
resetdate[128]; format(resetdate128"%s"getdate(year,month,day));
        
cache_get_field_content(i"ResetRaportDate"result); format(date256result);
        if(
strcmp(resetdatedatetrue) == 0)
        { 
I also created a test order, but no results:

PHP код:
CMD:resetraport(playeridparams[])
{
    new 
playerstring[256], query[256], d,m,y,h,mi,sgetdate(y,m,d); gettime(h,mi,s);
    if(
PlayerInfo[playerid][AdminLevel] >= 6)
    {
        if(
sscanf(params"u"player)) return SendClientMessage(playeridCOLOR_TEAL"Usage: {CECECE}/resetraport <player id>");
        if(
PlayerInfo[player][FactionID] >= && PlayerInfo[player][FactionRank] <= 6)
        {
            
format(stringsizeof(string), "Administrator %s reseted %s faction raport."GPlayerName(playerid), GPlayerName(player)), SendMessageToAdmins(DarkNiceRedstring);
            
mysql_format(SQLquerysizeof(query), "UPDATE `users` SET `ResetRaportDate` = '30-09-2018 00:30:00', `FactionRaport1` = '0', `FactionRaport2` = '0' AND `FactionRaport3` = '0' WHERE `name` = '%s'"dmyhmisGPlayerName(player)); mysql_tquery(SQLquery"""");
            
PlayerInfo[player][ResetDateYear] = yPlayerInfo[player][ResetDateMonth] = mPlayerInfo[player][ResetDateDay] = d; return 1;
        }
        else return 
SendClientMessage(playeridGrey"This player doesn't have a faction!");
    }
    else return 
0;

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!


Re: I have a problem! - Undef1ned - 29.09.2018

Please, use the "code or php" tag


Re: I have a problem! - akaDragonu - 30.09.2018

Done.

My question is how should I do a 7-day timer correctly, and how can I solve this problem because it does not work at all.


Re: I have a problem! - akaDragonu - 30.09.2018

The key code used by me to find out if today's date is the reset date of the report is:
PHP код:
new resetdate[128]; format(resetdate128"%s"getdate(year,month,day));
            
cache_get_field_content(0"ResetRaportDate"result); format(date256result);
            if(
strcmp(dateresetdatetrue) == 0



Re: I have a problem! - akaDragonu - 30.09.2018

I do not understand how I could do, all day I stayed and tried..


Re: I have a problem! - akaDragonu - 30.09.2018

Quote:
Originally Posted by Undef1ned
Посмотреть сообщение
Please, use the "code or php" tag
ssss