PDA

View Full Version : /mymute miliseconds --> minutes?

Metharon
19/05/2014, 03:42 PM
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?

Dignity
19/05/2014, 03:45 PM
Use a seperate variable that has the rounded digit.

rumen98
19/05/2014, 03:47 PM
show /mute command

Threshold
19/05/2014, 04:02 PM
(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.

NaClchemistryK
19/05/2014, 04:09 PM
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

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

creds to BenzoAMG for the original help..

Metharon
19/05/2014, 04:13 PM
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(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);
}
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);
}
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}))");
}
}
}
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;
}