Stupid radio - 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: Stupid radio (
/showthread.php?tid=138810)
Stupid radio -
[LSR]State_Trooper - 03.04.2010
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.
Re: Stupid radio -
dice7 - 03.04.2010
Maybe you have the civilians in the wrong gTeam ?
Re: Stupid radio -
[LSR]State_Trooper - 03.04.2010
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;
}
Re: Stupid radio -
dice7 - 03.04.2010
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
Re: Stupid radio -
[LSR]State_Trooper - 03.04.2010
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.
Re: Stupid radio -
[LSR]State_Trooper - 03.04.2010
Excuse double post!
I also have this.
gteam[playerid] = Team_Civ;
Re: Stupid radio -
[LSR]State_Trooper - 05.04.2010
**Bump** Been over 24 hours
Re: Stupid radio -
campkz - 05.04.2010
Maybe because, you can hear people talking on a radio, when ur stood right next to them?
Re: Stupid radio -
[LSR]State_Trooper - 05.04.2010
Nvm, I fixed this.