09.06.2010, 11:12
How can auto kick player when using same command for 3 times ??
new timesused; new oldcommand[128]; new newcommand[128];
new timesused[MAX_PLAYERS]; |
if (strcmp(cmd, "/command", true) == 0) { // Something here timesused[playerid]++ if(timesused[playerid] > 2) { Kick(playerid); } return 1; } |
if(!strcmp(cmd, "/command", true) == 0){
timesused[playerid] = 0;
}
new bool:firstcmd[MAX_PLAYERS]; new helpcmd[MAX_PLAYERS]; new mecmd[MAX_PLAYERS]; new killcmd[MAX_PLAYERS];
firstcmd[playerid]=true;
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; }