SA-MP Forums Archive
How to add message to all at this commands - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to add message to all at this commands (/showthread.php?tid=137188)



How to add message to all at this commands - Noredine - 28.03.2010

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);
}



Re: How to add message to all at this commands - DRIFT_HUNTER - 28.03.2010

use


SendClientMessageToAll


Re: How to add message to all at this commands - Brian_Furios - 28.03.2010

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);
}



Re: How to add message to all at this commands - Noredine - 28.03.2010

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


Re: How to add message to all at this commands - Toni - 28.03.2010

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


Re: How to add message to all at this commands - Noredine - 28.03.2010

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 ,


Re: How to add message to all at this commands - Noredine - 28.03.2010

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


Re: How to add message to all at this commands - Toni - 28.03.2010

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".