send message to leaders
#1

lets say some people are PINFO[playerid][leader] = 1;
How can I send a message to those people?
Reply
#2

Код:
CMD:message(playerid,params[])
{
    new text[128],string[128];
     if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, -1, "Use: /message [Text]");
      foreach(Player,i)
      {
      if(PINFO[i][leader] == 1)
      format(string,sizeof(string),"%s says : %s",GetPlayerName(playerid),text);
      SendClientMessage(i,-1,string);
      }
      return true;
}
You need foreach,zcmd,and sscanf
Reply
#3

Quote:
Originally Posted by HondaCBR
Посмотреть сообщение
lets say some people are PINFO[playerid][leader] = 1;
How can I send a message to those people?
Код:
if(PINFO[playerid][leader] == 1)
     SendClientMessage(playerid, -1, "...");
Is this what you mean? :S
Reply
#4

How about if I used,
new Check[MAX_PLAYERS]

Check[playerid] = 0;

if you type lets say /abc
Check[playerid] = 1;

Now if somone types /123
It shows a dialog for the player who is on check = 1
Reply
#5

Try something like this.
Код:
forward SendLeaderMessage(color,const string[],level);
Код:
public SendLeaderMessage(color,const string[],level)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if (PlayerInfo[i][pLeader] >= level)
			{
				SendClientMessage(i, color, string);
				printf("%s", string);
			}
		}
	}
	return 1;
}
And you can use it like sendclientmessage,but only for leaders.
Код:
SendLeaderMessage(COLOR,"This message is only for leaders", 1);
Reply
#6

Quote:
Originally Posted by HondaCBR
Посмотреть сообщение
How about if I used,
new Check[MAX_PLAYERS]

Check[playerid] = 0;

if you type lets say /abc
Check[playerid] = 1;

Now if somone types /123
It shows a dialog for the player who is on check = 1
Top of the script
Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Код:
new Check[MAX_PLAYERS];
Under OnPlayerCommandText
Код:
dcmd(abc, 3, cmdtext);
dcmd(123, 3, cmdtext);
Under the "}" of the OnPlayerCommandText
Код:
dcmd_abc(playerid, params[])
{
     #pragma unused params
     if(IsPlayerConnected(playerid))
          if(Check[playerid] == 0)
                Check[playerid] = 1;
     return 1;
}
Under the "}" of dcmd_abc put
Код:
dcmd_123(playerid, params[])
{
       #pragma unused params
       for(new i = 0; i < MAX_PLAYERS; ++i)
       {
             if(IsPlayerConnected(i))
                    if(Check[i] == 1)
                         SendClientMessage(playerid, -1, "ID: %d", i);
       }
       return 1;
}
This dont put the player in a dialog but sends a message to the player with the player's ID's that "Check = 1"
Try it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)