[HELP]Team Chat -
<Weponz> - 25.12.2010
My team chat just isnt working :S
Can anyone help?
Please have a look a it,
pawn Код:
CMD:a(playerid, params[])
{
if(gTeam[playerid] == CLASS_AIRFORCE)
{
new string[128], pname[24];
if(isnull(params)) return SendClientMessage(playerid, RED, "USAGE: /a [msg]");
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), ">> %s @ [Airforce Radio]: %s",pname,params);
printf("%s", string);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(gTeam[i] == CLASS_AIRFORCE)
{
format(string, sizeof(string), ">> %s @ [Airforce Radio]: %s",pname,params);
AirforceRadio(BLUE,string);
}
}
} else SendClientMessage(playerid, RED, "Only The Airforce Can Use This Frequency!");
return true;
}
EDIT:
The USAGE shows but does nothing when i do the command.
Re: [HELP]Team Chat -
Sascha - 25.12.2010
show the "public AirforceRadio(color, text[])"
Re: [HELP]Team Chat -
Mean - 25.12.2010
You got it ALL wrong
Try
pawn Код:
CMD:a(playerid, params[])
{
if(gTeam[playerid] != CLASS_AIRFORCE) return SendClientMessage(playerid, RED, "Only The Airforce Can Use This Frequency!");
new string[128], pname[MAX_PLAYER_NAME];
if(isnull(params)) return SendClientMessage(playerid, RED, "USAGE: /a [msg]");
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
format(string, sizeof(string), ">> %s @ [Airforce Radio]: %s",pname,params);
print(string);
format(string, sizeof(string), ">> %s @ [Airforce Radio]: %s",pname,params);
for(new i=0; i<MAX_PLAYERS; i++) if(gTeam[i] == gTeam[playerid]) SendClientMessage(i, BLUE, string);
return 1;
}
Re: [HELP]Team Chat -
Sascha - 25.12.2010
ehm... you know that you write actually the same as he did, but in another way?... he made some line breaks, etc. to make it more clear... you just wrote it all behind each other...
both ways will do the same...
you should learn some coding basics before telling someone he has everything wrong because he has another style than you...
Re: [HELP]Team Chat -
[NWA]Hannes - 25.12.2010
Show us the "public AirforceRadio(...)" function.
Re: [HELP]Team Chat -
Mean - 25.12.2010
No, I used SendClientMessage, he used AirforceRadio, so it's not the same!
And this code actually works for me...
Re: [HELP]Team Chat -
Sascha - 25.12.2010
then there is only 1 thing wrong and not "ALL".
Also you don't know what he scripted at his AirforceRadio, do you?
You can judge about such a thing if you don't know the code...
Re: [HELP]Team Chat -
Mean - 25.12.2010
He used wrong loops, thats not ONLY 1 thing, now quit it. Also, he did "printf" wrong, so not 1 thing...
Re: [HELP]Team Chat -
Sascha - 25.12.2010
the way he used printf is weird but possible,
in addition he did nothing wrong on the loop.
As he uses the radio for the airforce only you don't need to check it like "gteam[i] == gteam[playerid]", you can also do it like he did "gteam[i] == TEAM_AIRFORCE"