Team Message Error
#1

Hai,

I have an error with my teams.

I have told my 911 system to
pawn Код:
SendMessageToLaw(str);
SendMessageToLawCode:

pawn Код:
SendMessageToLaw(const str[])
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i)) {
if (PlayerTeam[i] == Team_NSP || Team_LVPD) {
SendClientMessage(i, COLOR_CRIMBLUE, str);
}
}
}
}
I have Defined and Set My Teams;

OnPlayerConnect()
{
PlayerTeam[playerid] = Team_Civ;
return 1;
}

OnPlayerSpawn()
{
PlayerTeam[playerid] = Team_Civ;
return 1;
}

Yet, It send the message to everyone, But The Fire and EMS do not.


911 Code;

pawn Код:
case 4:
                {
                GetPlayerName(playerid, playername, sizeof(playername));
                format(string, sizeof(string), "-------------------------------------------------------------------------------------------------------------");
                SendMessageToLaw(string);
                format(string, sizeof(string), "POLICE DISPATCH (911 CALL)");
                SendMessageToLaw(string);
                format(string, sizeof(string), "Be advised. The following is a 911 call relay.");
                SendMessageToLaw(string);
                format(string, sizeof(string), "Caller name: %s",playername);
                SendMessageToLaw(string);
                format(string, sizeof(string), "Caller ID: %d",playerid);
                SendMessageToLaw(string);
                format(string, sizeof(string), "Quoted information: Caller was Just Robbed");
                SendMessageToLaw(string);
                format(string, sizeof(string), "Caller traced location: %s",zones[current_zone][zone_name]);
                SendMessageToLaw(string);
                format(string, sizeof(string), "-------------------------------------------------------------------------------------------------------------");
                SendMessageToLaw(string);
                }
Reply
#2

Those lines which do not need to be formatted should not be formatted. e.g "---", "Police Dispatch","Be advised".


This does not have to do with the error.


SendClientMessage already has implemented check if the player is connected so the check before SCM isn't required. (Correct me If I'm wrong)
Reply
#3

pawn Код:
SendMessageToLaw(const str[])
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if (PlayerTeam[i] == Team_NSP || PlayerTeam[i] == Team_LVPD)
            {
                SendClientMessage(i, COLOR_CRIMBLUE, str);
            }
        }
    }
}
case 4:
{
    GetPlayerName(playerid, playername, sizeof(playername));
    SendMessageToLaw("-------------------------------------------------------------------------------------------------------------");
    SendMessageToLaw("POLICE DISPATCH (911 CALL)");
    SendMessageToLaw("Be advised. The following is a 911 call relay.");
    format(string, sizeof(string), "Caller name: %s",playername);
    SendMessageToLaw(string);
    format(string, sizeof(string), "Caller ID: %d",playerid);
    SendMessageToLaw(string);
    SendMessageToLaw("Quoted information: Caller was Just Robbed");
    format(string, sizeof(string), "Caller traced location: %s",zones[current_zone][zone_name]);
    SendMessageToLaw(string);
    SendMessageToLaw("-------------------------------------------------------------------------------------------------------------");
}
And why you ned return 1; if its Civil team?
Reply
#4

Okay people. When I posted OnPlayerConnect Etc. That wasn't my on player connect. I typed it to show what fucntion I had under those headings. The 911 Code is part of my Unique Dialog 911 System. Then SendMessage to law code is at the top of my script.

SendMessageToLaw Sends a meesage to Team_NSP ( Nevada State Patrol ) and Team_LVPD ( Las Vegas Police Dept). But the code is some where sending it to The Civ Team even know its not meant to.
Reply
#5

I fixed it. Thanks for the help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)