How to add message to all at this commands
#1

Hey all , i need add client message to all , if man type /onduty and he On Duty ! sendclientmessagetoall %s is now on duty and if he Playing %s is now playing

Here the code.

pawn Код:
dcmd_onduty(playerid,params[])
{
  #pragma unused params
    if (AccInfo[playerid][Level] >= 2)
    {
      if(AccInfo[playerid][OnDuty] == 0)
      {
            AccInfo[playerid][OnDuty] = 1;
            return SendClientMessage(playerid,green,"|- You are now in \"Duty Mode\" -|");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            return SendClientMessage(playerid,orange,"|- You are now in \"Playing Mode\"-|");
        }
    }
    return ErrorMessages(playerid, 5);
}
Reply
#2

use


SendClientMessageToAll
Reply
#3

try this:


pawn Код:
dcmd_onduty(playerid,params[])
{
  #pragma unused params
    if (AccInfo[playerid][Level] >= 2)
    {
      if(AccInfo[playerid][OnDuty] == 0)
      {
            AccInfo[playerid][OnDuty] = 1;
            return SendClientMessageToAll(playerid,green,"|- You are now in \"Duty Mode\" -|");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            return SSendClientMessageToAll(playerid,orange,"|- You are now in \"Playing Mode\"-|");
        }
    }
    return ErrorMessages(playerid, 5);
}
Reply
#4

Quote:
Originally Posted by Brian_Furios
try this:


pawn Код:
dcmd_onduty(playerid,params[])
{
  #pragma unused params
    if (AccInfo[playerid][Level] >= 2)
    {
      if(AccInfo[playerid][OnDuty] == 0)
      {
            AccInfo[playerid][OnDuty] = 1;
            return SendClientMessageToAll(playerid,green,"|- You are now in \"Duty Mode\" -|");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            return SSendClientMessageToAll(playerid,orange,"|- You are now in \"Playing Mode\"-|");
        }
    }
    return ErrorMessages(playerid, 5);
}
Lol

i need the sendclientmesage and the sendclientmessagetoall do'nt just one
Reply
#5

Try This for a SendClientMessageToAll.
pawn Код:
dcmd_onduty(playerid,params[])
{
    #pragma unused params
    if (AccInfo[playerid][Level] >= 2)
    {
        if(AccInfo[playerid][OnDuty] == 0)
        {
            AccInfo[playerid][OnDuty] = 1;
            return SendClientMessageToAll(green, "|- You are now in \"Duty Mode\" -|");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            return SendClientMessageToAll(orange, "|- You are now in \"Playing Mode\"-|");
        }
    }
    return ErrorMessages(playerid, 5);
}
If it's to everyone, you don't add "playerid" because it's not going to be sent to only one person. You only need the colour and the Message.

Hope This Helps.

-Toni
Reply
#6

Quote:
Originally Posted by Tɧ϶ Tσηί™
Try This for a SendClientMessageToAll.
pawn Код:
dcmd_onduty(playerid,params[])
{
    #pragma unused params
    if (AccInfo[playerid][Level] >= 2)
    {
        if(AccInfo[playerid][OnDuty] == 0)
        {
            AccInfo[playerid][OnDuty] = 1;
            return SendClientMessageToAll(green, "|- You are now in \"Duty Mode\" -|");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            return SendClientMessageToAll(orange, "|- You are now in \"Playing Mode\"-|");
        }
    }
    return ErrorMessages(playerid, 5);
}
If it's to everyone, you don't add "playerid" because it's not going to be sent to only one person. You only need the colour and the Message.

Hope This Helps.

-Toni
u don't know what i need ...

Don't touch send client message you on duty now ..
I need add Sendclientmessagetoall after the sendclientmessage
this said %s Is now On duty
Now u know what i need ,
Reply
#7

Quote:
Originally Posted by » ραωпsтαг «
Easy.

pawn Код:
dcmd_onduty(playerid,params[])
{
  #pragma unused params
    new string[128];
    if (AccInfo[playerid][Level] >= 2)
    {
      if(AccInfo[playerid][OnDuty] == 0)
      {
            AccInfo[playerid][OnDuty] = 1;
            format(string, sizeof(string), "|- %s is now on duty!", pName(playerid));
            SendClientMessageToAll(green, string);
            return SendClientMessage(playerid,green,"|- You are now in \"Duty Mode\" -|");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            format(string, sizeof(string), "|- %s is now off duty!", pName(playerid));
            SendClientMessageToAll(green, string);
            return SendClientMessage(playerid,orange,"|- You are now in \"Playing Mode\"-|");
        }
    }
    return ErrorMessages(playerid, 5);
}
You will need this stock, add it with your other stock functions.

pawn Код:
stock pName(playerid)
{
 new nick[MAX_PLAYER_NAME];
 GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
 return nick;
}
Thank you
Reply
#8

Quote:
Originally Posted by Noredine
Quote:
Originally Posted by » ραωпsтαг «
Easy.

pawn Код:
dcmd_onduty(playerid,params[])
{
  #pragma unused params
    new string[128];
    if (AccInfo[playerid][Level] >= 2)
    {
      if(AccInfo[playerid][OnDuty] == 0)
      {
            AccInfo[playerid][OnDuty] = 1;
            format(string, sizeof(string), "|- %s is now on duty!", pName(playerid));
            SendClientMessageToAll(green, string);
            return SendClientMessage(playerid,green,"|- You are now in \"Duty Mode\" -|");
        }
        else
        {
            AccInfo[playerid][OnDuty] = 0;
            format(string, sizeof(string), "|- %s is now off duty!", pName(playerid));
            SendClientMessageToAll(green, string);
            return SendClientMessage(playerid,orange,"|- You are now in \"Playing Mode\"-|");
        }
    }
    return ErrorMessages(playerid, 5);
}
You will need this stock, add it with your other stock functions.

pawn Код:
stock pName(playerid)
{
 new nick[MAX_PLAYER_NAME];
 GetPlayerName(playerid, nick, MAX_PLAYER_NAME);
 return nick;
}
Thank you
Sorry, I didn't Understand what you meant by "add client message to all".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)