how to make report time limit cmd?
#1

Hi to all, i want when player send message, that he cant do it next 2 minutes. I have simple report cmd but how to make this i want?

here is cmd

Код:
if(strcmp(cmd, "/report", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
 			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Use: /report [text]");
				return 1;
			}
  			format(string, sizeof(string), "Report od %s: %s", sendername, (result));
			ABroadCast(COLOR_YELLOW,string,1);
			SendClientMessage(playerid, COLOR_YELLOW, "Your report message send to admins.");
	  }
	  return 1;
	}
So i need this

1. after one report, player cant send next report in next 2 minutes
2. if he try to send that get message " you must wait 2 minutes to send next report"

Can someone help me with this, make cmd for 2 minutes )

tnx a lot
Reply
#2

pawn Код:
//TOP
new rTime[MAX_PLAYERS];

if(strcmp(cmd, "/report", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
        GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Use: /report [text]");
                return 1;
            }
            if(rTime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "You must wait 2 minutes until your next report!");
            format(string, sizeof(string), "Report od %s: %s", sendername, (result));
            ABroadCast(COLOR_YELLOW,string,1);
            SendClientMessage(playerid, COLOR_YELLOW, "Your report message send to admins.");
            rTime[playerid] = 1;
            SetTimerEx("Report", 120000, 0, "%d", playerid);
      }
      return 1;
    }
//==================================================

forward Report(playerid);
public Report(playerid)
{
  rTime[playerid] = 0;
}
Reply
#3

tnx...just one more question, where tu put message " you must wait 2 minutes to send next report message" ? )
Reply
#4

Its already in there

pawn Код:
if(rTime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "You must wait 2 minutes until your next report!");
Reply
#5

ohhh sorry i didnt see

i have problem, i now try this cmd, and i try to send 2 report messages in few seconds, and i can do it...so timer didnt work, what is problem?
Reply
#6


Not sure if that helps, But thats how I would so it:
pawn Код:
SetTimerEx("Report", 120000,false, "%d", playerid);
Reply
#7

Quote:
Originally Posted by ŚĂĞĔ
Not sure if that helps, But thats how I would so it:
pawn Код:
SetTimerEx("Report", 120000,false, "%d", playerid);
Yes, this been problem, its fixed now...tnx to all for help )))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)