Need Help
#1

How can auto kick player when using same command for 3 times ??
Reply
#2

Do you want it for all commands or only one?

Код:
new timesused;
new oldcommand[128];
new newcommand[128];
Then you basically check if oldcommand is same is new command an stuff. Not sure how you will go about doing that. But you will need to get old command and new command in each command you want to do this for.
Reply
#3


Quote:

new timesused[MAX_PLAYERS];

Quote:

if (strcmp(cmd, "/command", true) == 0)
{
// Something here
timesused[playerid]++
if(timesused[playerid] > 2)
{
Kick(playerid);
}
return 1;
}

Try that, I haven't tested it.
Reply
#4

and obviously if 3 times in a row, then add another if at the beginning of onPlayerCommandText
something like:

pawn Код:
if(!strcmp(cmd, "/command", true) == 0){
timesused[playerid] = 0;
}
Reply
#5

It's a very tricky question :P

How is it possible to get the command entered 3 times in a row.MMMMMMMMMM

I know
Take these three commands for eg:
Код:
new bool:firstcmd[MAX_PLAYERS];
new helpcmd[MAX_PLAYERS];
new mecmd[MAX_PLAYERS];
new killcmd[MAX_PLAYERS];
Under OnPlayerConnect
Код:
firstcmd[playerid]=true;
OnPlayerCommandText

Код:
if(!strcmp(cmdtext,"/help",5,true))
{
  if(firstcmd[playerid]==true)
  {
    firstcmd[playerid]=false;
    helpcmd[playerid]++;
  }
  else helpcmd++;
  killcmd[playerid]=0;
  mecmd[playerid]=0;

//your helpcode

  if(helpcmd[playerid]>3)
  {
    Kick(playerid);
  }
  return 1;
}

if(!strcmp(cmdtext,"/me",3,true))
{
  if(firstcmd[playerid]==true)
  {
    firstcmd[playerid]=false;
    mecmd[playerid]++;
  }
  else mecmd[playerid]++;
  killcmd[playerid]=0;
  helpcmd[playerid]=0;
  //your me code
  if(mecmd[playerid]>3)
  {
    Kick(playerid);
  }

  return 1;
}

if(!strcmp(cmdtext,"/kill",5,true))
{
  if(firstcmd[playerid]==true)
  {
    firstcmd[playerid]=false;
    killcmd[playerid]++;
  }
  else killcmd[playerid]++;
  mecmd[playerid]=0;
  helpcmd[playerid]=0;

//your kill code

  if(killcmd[playerid]>3)
  {
    Kick(playerid);
  }

  return 1;
}
How about that?
Reply
#6

It's show the error when i complie

: error 033: array must be indexed (variable "firstcmd")
: error 033: array must be indexed (variable "firstcmd")
: error 022: must be lvalue (non-constant)
Reply
#7

Oops, I modified my post try it now. :P
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)