Stupid radio
#1

Ok... So this has been pising me off for about two days. Civilians can see my radio messages and use my radio. I dont kno why though.

Heres the Code that the radio usews to send it to teams.

pawn Код:
SendMessageToLaw(const str[])
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i)) {
if (gteam[i]==Team_FBI || gteam[i]==Team_SFPD || gteam[i]==Team_LVPD || gteam[i]==Team_SASP || gteam[i]==Team_DCP || gteam[i] == Team_DCPT || L1A[i]==1 || gteam[i]==Team_GOV) {
SendClientMessage(i, COLOR_CRIMBLUE, str);
}
}
}
}
But I don't know why it's doing this.... Mabye someone cna help me.... I dont know If I coded it wrong.
Reply
#2

Maybe you have the civilians in the wrong gTeam ?
Reply
#3

As far as I know there fine.

pawn Код:
public OnPlayerConnect(playerid)
{
                    new string[64], pName[MAX_PLAYER_NAME];
                  GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
                  format(string,sizeof string,"%s has connected to the server.",pName);
                  SendClientMessageToAll(COLOR_YELLOW,string);
                    ResetPlayerWeapons(playerid);
            TogglePlayerControllable(playerid,1);
                    SetPlayerTeam(playerid,Team_Civ);
return 1;
}
Reply
#4

SetPlayerTeam sets a player in a team server sided, meaning only the server knows which player is in which team and you can get his team only with GetPlayerTeam.

gTeam is in your script nothing else, It's just a variable. It's like doing
pawn Код:
new a;
a=5;
if (a == 5) SendClientMessage();
With gTeam you're assigning a player to a team script wise, which means that you can get his team only in that script. SetPlayerTeam and gTeam have nothing in common, except they're both used for assigning a player to a team. But I can easily change the gTeam variable to like eg. PlayersTeam.

You need to set the players gTeam variable to civilian in order for that SendMessageToLaw function to work
Reply
#5

How would I go about doing that... I mean Everything on the server uses teams, there easier to use than factions and take half the codeing time.
Reply
#6

Excuse double post!

I also have this.

gteam[playerid] = Team_Civ;
Reply
#7

**Bump** Been over 24 hours
Reply
#8

Maybe because, you can hear people talking on a radio, when ur stood right next to them?
Reply
#9

Nvm, I fixed this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)