31.05.2014, 09:46
Hello,
Im trying to make a radio/walkie talkie system. If you want to setup a teamchat you only have to set eachothers
radio frequencie to the same level.
the getfrequentie i made here returns the correct frequencie a player has set.
I just cant get the chat itself to work. (in some tryouts the text showed for all and some not at all)
What should i do on onplayertext to make it work ?
Im trying to make a radio/walkie talkie system. If you want to setup a teamchat you only have to set eachothers
radio frequencie to the same level.
the getfrequentie i made here returns the correct frequencie a player has set.
pawn Код:
new TotalFreqientie[MAX_PLAYERS];
stock GetPlayerFrequentie(playerid)
{
new frq[20];
format(frq, sizeof(frq), "%d.%d", FreqCount1[playerid],FreqCount2[playerid]);
printf(frq);
new TotalFreqientie[playerid] = GetPVarInt(playerid,frq);
return 1;
}
I just cant get the chat itself to work. (in some tryouts the text showed for all and some not at all)
pawn Код:
public OnPlayerText(playerid, text[])
{
if(text[0] == '!')
{
new string[100];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string),":Radio: %s: %s", sendername,text[1]);
for(new i = 0; i < MAX_PLAYERS; i++)//foreach(Player,i)
{
// new frequentie = GetPlayerFrequentie(i);
if(GetPVarInt(i,TotalFreqientie[i]))
{
SendClientMessage(i,COLOR_YELLOW,string);
}
}
return 0;
}
return 1;
}