CMD help
#1

Actually, I want to get a command like this, current player = playerid, otherplayer = otherid;

then If current player ignores otherplayer, then if otherplayer types something in the chat
then the current player cant see the text which otherplayer wrote in the chat..

so, pleaze can you make this system for me, and CMD should be named as /ignore that if a player ignore otherplayer, then the current player cant see the of otherplayer, which otherplayer wrote in the chat..

pleaze, guide me with this cmd or make it for me.
Reply
#2

idk what you really mean but to make playerid+otherid use this with sscanf
pawn Код:
#include <a_samp>
#include <sscanf2>
#include <zcmd>

CMD:ignore(playerid,params[])
{
  new otherid;//this means the targetid, or the other id you meant
  return 1;
}
Reply
#3

i scripted this command, SRY NVM every time i try to paste in this SOB it rapes my indentation
Reply
#4

Thanks, Necro, give me it fastly.
Reply
#5

Can you give me it fast,Necro i cant wait sorry for bumping.
Reply
#6

Код:
#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
Reply
#7

What this cmd means, if we ignore somebody then the text sent by the somebody will appear in other color, or it will not appear in our chat?
Reply
#8

you will only see text from players you are NOT ignoring
Reply
#9

It won't appear to the player that ignored the other guy.
Reply
#10

but it appears double chat
when i edited on player text like this
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]){
}
}
then the doublechat removed, and thanks for your cmd boy.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)