/mymute miliseconds --> minutes?
#1

Код:
			new string[256];
			format(string, sizeof(string), "~y~Minute minutes blabla  ~n~~r~%d~y~ seconds", PlayerInfo[playerid][pMuteTime]); <-- pmutedtime , the mute time in miliseconds 
			GameTextForPlayer(playerid, string, 5000, 1);
[/code]

How can i convert miliseconds in minutes, to show for player in minutes not miliseconds?
Reply
#2

Use a seperate variable that has the rounded digit.
Reply
#3

show /mute command
Reply
#4

(PlayerInfo[playerid][pMuteTime] / 60000) = Milliseconds / 60000 = Minutes.

1 seconds = 1000 Milliseconds.
1 minute = 60 seconds = 60 x 1000 milliseconds = 60000 milliseconds.

So replace PlayerInfo[playerid][pMuteTime], with (PlayerInfo[playerid][pMuteTime] / 60000)

EDIT: Or (PlayerInfo[playerid][pMuteTime] / 1000) if you want it in seconds.
Reply
#5

The poster above said it all correctly. But lemme explain it a little better...
there are certain orperators. A " / " stands for dividing, a " * " stands for multiplying, a " + " stands for adding, and a " - " stands for subtrating. Now, one second equals 1000 in SetTimerEx. so when you want to show the player that he is muted for 1 second, you have to divide it with 1000. Simple.
So as the poster above said
Quote:

So replace
pawn Код:
PlayerInfo[playerid][pMuteTime]
with
pawn Код:
(PlayerInfo[playerid][pMuteTime] / 60000)
creds to BenzoAMG for the original help..
Reply
#6

Код:
if(strcmp(cmd, "/mute", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    new string[456];
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{00CCFF}(( {FFCC00}Exemplu folosire: {FF9930} /mute [id] [minute] {00CCFF}))");
				return 1;
			}
			new playa;
			new time;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			time = strval(tmp);
			if (PlayerInfo[playerid][Administrator])
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
				        GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						if (time > 1)
						{
						format(string, sizeof(string), "(LS-CP) {CC0033}Jucatorul %s a primit mute de la administratorul %s pentru %d minute!", giveplayer, sendername, time);
						SendClientMessageToAllEx(COLOR_GRAD1, string);		
                        }	
						if (time == 1)
						{
						format(string, sizeof(string), "(LS-CP) {CC0033}Jucatorul %s a primit mute de la administratorul %s pentru %d minut!", giveplayer, sendername, time);
						SendClientMessageToAllEx(COLOR_GRAD1, string);		
                        }							
						PlayerInfo[playa][pMute] = 1;
						PlayerInfo[playa][pMuteTime] = time*6000;
						format(string, sizeof(string), "(LS-CP) {00CCFF}(( {FFCC00}Informatie - {FF9930}scrie /mymute pentru a afla timpul ramas din mute {00CCFF}))");	
						SendClientMessage(playa, COLOR_GRAD1, string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "{00CCFF}(( {FFCC00}Informatie -{FF9930} nu ai accces la aceasta comanda! {00CCFF}))");
			}
		}
		return 1;
	}
and the new
/mymute
Код:
if(strcmp(cmd, "/mymute", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
		    if(PlayerInfo[playerid][pMute] == 1)
			{
			new string[256];
			new timpramas = PlayerInfo[playerid][pMuteTime] / 60000;
			format(string, sizeof(string), "~y~Timp ramas din mute ~n~~r~%d~y~ minute ramase",timpramas);
			GameTextForPlayer(playerid, string, 5000, 1);
			}
		}
		return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)