Код:
#include <ZCMD>
new bool:IgnorePlayer[MAX_PLAYERS][MAX_PLAYERS];
COMMAND:ignore(playerid,params[]) {
new tmp[256], Index; tmp = strtok(params,Index);
if(!strlen(tmp)) {
SendClientMessage(playerid,YELLOW,"HELP: /ignore [playerid] --- /ignore All --- /ignore None");
SendClientMessage(playerid,YELLOW,"Ignore - the players you are ignoring can not send you ANY messages");
}
if(strcmp(tmp,"help",true,4)==0){
SendClientMessage(playerid,YELLOW,"HELP: /ignore [playerid] --- /ignore All --- /ignore None");
SendClientMessage(playerid,YELLOW,"Ignore - the players you are ignoring can not send you ANY messages");
}else if(strcmp(tmp,"All",true,3)==0){
for(new i=0;i<MAX_PLAYERS;i++){
if(i!=playerid){
IgnorePlayer[playerid][i]=true;
}
}
SendClientMessage(playerid,DARKPINK,"You are Ignoring Everyone");
}else if(strcmp(tmp,"None",true,4)==0){
for(new i=0;i<MAX_PLAYERS;i++){
if(i!=playerid){
IgnorePlayer[playerid][i]=false;
}
}
SendClientMessage(playerid,DARKPINK,"You are Ignoring Nobody");
}else if(isNumeric(params)){
new player1 = strval(tmp);
if(playerid != player1) {
if(!IsPlayerConnected(player1)) return SendClientMessage(playerid,RED,"PLAYER NOT CONNECTED");
new string[128], name[30];
GetPlayerName(player1,name,30);
if(IgnorePlayer[playerid][player1]==false){
format(string,sizeof(string),"You are ignoring %s (%d)",name,player1);
IgnorePlayer[playerid][player1]=true;
}else if(IgnorePlayer[playerid][player1]==true){
format(string,sizeof(string),"You are NOT Ignoring %s (%d)",name,player1);
IgnorePlayer[playerid][player1]=false;
}
SendClientMessage(playerid,DARKPINK,string);
}else{
SendClientMessage(playerid,RED,"You Can't Ignore Yourself");
}
}else{
SendClientMessage(playerid,YELLOW,"HELP: /ignore [playerid] --- or All / None");
SendClientMessage(playerid,YELLOW,"Ignore - the players you are ignoring can not send you ANY messages");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
for(new i=0;i<MAX_PLAYERS;i++){
IgnorePlayer[i][playerid]=false;
IgnorePlayer[playerid][i]=false;
}
return 1;
}
public OnPlayerText(playerid, text[])
{
new string[256], name[24], pColor;
GetPlayerName(playerid,name,24);
pColor=GetPlayerColor(playerid) >>> 8;
format(string,128,"{%06x}%s: {FFFFFF}%s", pColor,name,text[0]);
for(new i=0;i<MAX_PLAYERS;i++){
if(!IgnorePlayer[i][playerid]){
SendClientMessage(i,0xFFFFFFFF,string);
}
}
return 0;
}
//credits: dracoblue
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
stock isNumeric(const string[]) {
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++) {
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
|| (string[i]=='-' && i!=0) // A '-' but not at first.
|| (string[i]=='+' && i!=0) // A '+' but not at first.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}
k think thats it. it will point u to the right direction atleast, colors not defined obv.
needs things in other message sends aswell like pms but i'll let u figure it out
the indention still messed up a bit i tried to fix as much as i could