[HELP] Unjail countdown
#9

I can show similar code with chat mute system. I hope this helps you.

Код:
CMD:amute(playerid,params[])
{
	new banid, banname[MAX_PLAYER_NAME],adminName[MAX_PLAYER_NAME], string[129], reason[128], mtime;
	
	if(!pData[playerid][pAdmin]) 
		return SendClientMessage(playerid,COLOR_RED,"ERROR!");
	
	if(sscanf(params,"dds[128]",banid, mtime, reason)) 
		return SendClientMessage(playerid,-1,"{80BCFF}use:{FFFFFF} /mute <id> <time> <reason>");
	
	if(!IsPlayerConnected(banid)) 
		return SendClientMessage(playerid,COLOR_RED,"Wrong ID.");
	
	pData[banid][aMute] = gettime()+mtime*60; //write unixtime + mute time * 60

	return 1;
}

// Add to Secondary Timer

Код:
foreach (new i : Player)
{
	if(pData[i][aMute])
	{
	     if(gettime() >=  pData[i][aMute]) // if unixtime now > or = mute time, unmute player.
			pData[i][aMute] = 0;
	}
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
     if(pData[playerid][aMute] > gettime() && pData[playerid][aMute]) // if player have mute and time mute > or = mute time
	     pData[playerid][aMute] = pData[playerid][aMute] - gettime(); // reaming unix time - unix time
     else
          pData[playerid][aMute] = 0; // else set mute time 0


		mysql_format(mysql, query, sizeof(query),"UPDATE `login` SET `murders` = '%d', `death` = '%d', `reputation` = '%d', `description` = '%s', `mute` = '%d', `warn` = '%d' WHERE id='%d'", pData[playerid][pMurders], pData[playerid][pDeath], pData[playerid][pReputation], SQL_ReturnEscaped(pData[playerid][pDescription]), pData[playerid][aMute], pData[playerid][warn], pData[playerid][pID]);
		mysql_tquery (mysql, query)
; // here write reaming mute time on base or file

When player connect
Код:
                new temp[128];		
                cache_get_row(0, 11, temp, mysql, 12);
		pData[playerid][aMute] = gettime() + strval(temp);
Reply


Messages In This Thread
[HELP] Unjail countdown - by ThomasEvil - 03.06.2017, 22:52
Re: [HELP] Unjail countdown - by Jefff - 04.06.2017, 00:49
Re: [HELP] Unjail countdown - by ThomasEvil - 04.06.2017, 04:14
Re: [HELP] Unjail countdown - by silverms - 04.06.2017, 09:37
Re: [HELP] Unjail countdown - by Abagail - 04.06.2017, 15:24
Re: [HELP] Unjail countdown - by Jefff - 04.06.2017, 18:03
Re: [HELP] Unjail countdown - by ThomasEvil - 05.06.2017, 05:51
Re: [HELP] Unjail countdown - by ThomasEvil - 05.06.2017, 06:05
Re: [HELP] Unjail countdown - by UHPS - 05.06.2017, 06:14
Re: [HELP] Unjail countdown - by ThomasEvil - 05.06.2017, 06:30

Forum Jump:


Users browsing this thread: 1 Guest(s)