SA-MP Forums Archive
SendDivisionMessage - 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)
+--- Thread: SendDivisionMessage (/showthread.php?tid=345761)



SendDivisionMessage - Aira - 26.05.2012

Hello, i've been trying to make a /dc(divisionChat) command and here's my command
pawn Код:
CMD:dc(playerid, params[])
{
    new string[128];
    if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /dc [Division Chat]");
    switch(PlayerInfo[playerid][pDivision])
    {
        case 1: division = " (Army)";
        case 2: division = " (Navy)";
        case 3: division = " (Air Force)";
        case 4: division = " (USMC)";
        case 5: division = " (Coast Guard)";
        case 6: division = " (MP)";
        format(string, sizeof(string), "** %s%s %s: %s **", rank, division, GetPlayerNameEx(playerid), params);
        SendDivisionMessage(?WhatDOINeedtoPuthereSoThatITWillSendIttoitsDivision?, RADIO, string);
    }
        return 1;
}
and here's my SendDivisionMessage

pawn Код:
forward SendDivisionMessage(division, color, string[]);
public SendDivisionMessage(division, color, string[])
{
    foreach(Player, i)
    {
        if(PlayerInfo[i][pDivision] == division)
        {
            SendClientMessageEx(i, color, string);
        }
    }
}
Now as you can see my
SendDivisionMessage(?WhatDOINeedtoPuthereSoThatITW illSendIttoitsDivision?, RADIO, string);
Well the question is there
What do i need to put in
SendDivisionMessage("HERE", RADIO, string);
So that it will send it to the dudes in his division?


Re: SendDivisionMessage - JaTochNietDan - 26.05.2012

You need to pass the ID of the division I assume, which you appear to have stored in your PlayerInfo variable, so why not just do this:

pawn Код:
SendDivisionMessage(PlayerInfo[playerid][pDivision], RADIO, string);
Hope that was what you were looking for.