I have made a newbie chat. -
Harry_Sandhu - 07.08.2011
I have made a Newbie chat.
I have added a command in it with ZCMD.
/nmute [playerid] [time] [Reason]
When i do /nmute [id] [time] [reason] then it works fine and then it also unmutes after the given time.
I just want to add a thing that if a player is nmuted then it should show a message every minute that %d minutes left to be unmuted from newbie chat.
For Example-
A player is muted for 5minutes.
1 minute ago....
4minutes left to be unmuted from the Newbie chat.
2 minutess agoo....
3 minutes left to be unmuted from the newbie chat.
5 minutes ago....
You are unmuted from the newbie chat.
I am using
pawn Код:
pNMuted, (The player is nmuted)
pNMDuration, (For total how much time a player is muted.)
Re: I have made a newbie chat. -
JaTochNietDan - 07.08.2011
I'm guessing you're using a system with a timer, which is silly, instead of using wasteful timers, why not make use of GetTickCount? For example:
pawn Код:
// Your command code.....
pNMMuteTime = GetTickCount();
// When he tries to talk
new iCount = GetTickCount() - pNMMuteTime;
if(iCount >= 300000) // check if 5 minutes has passed!
{
// PLayer can talk...
}
else
{
printf("You still have %d minutes to go!", iCount/60000); // Tell him how long he has left in minutes...
}
I hope that helps..!
Re: I have made a newbie chat. -
Harry_Sandhu - 07.08.2011
Can you send me the Full Code?
I want that it should send the Client Message about that. Not only five minutes it should be 10minutes 15also. and more..
Re: I have made a newbie chat. -
JaTochNietDan - 07.08.2011
What do you mean the full code? I gave you what needs to be added to your current code for it to work! Using your variable the if statement would be:
pawn Код:
if(iCount >= pNMDuration * 1000)
That's assuming that your duration is in seconds, if it's in minutes you need to multiply by 60,000!
Re: I have made a newbie chat. -
Harry_Sandhu - 07.08.2011
My Duration is in minutes and i want a message shows every second %d minutes left to be unmuted from newbie chat.
And after the time given completes then it should show a message
You have been unmuted from newbie chat. Your mute time period expired.
Re: I have made a newbie chat. -
emokidx - 07.08.2011
what he said is correct
open your mind and work yourself by the given example
Quote:
Originally Posted by JaTochNietDan
pawn Код:
if(iCount >= pNMDuration * 1000)
That's assuming that your duration is in seconds, if it's in minutes you need to multiply by 60,000!
|
cant you understand that?
Re: I have made a newbie chat. -
Harry_Sandhu - 07.08.2011
My Duration is in minutes and i want a message shows every second %d minutes left to be unmuted from newbie chat.
And after the time given completes then it should show a message
You have been unmuted from newbie chat. Your mute time period expired.