[HELP]Team Chat
#1

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.
Reply
#2

show the "public AirforceRadio(color, text[])"
Reply
#3

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;
}
Reply
#4

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...
Reply
#5

Show us the "public AirforceRadio(...)" function.
Reply
#6

No, I used SendClientMessage, he used AirforceRadio, so it's not the same!
And this code actually works for me...
Reply
#7

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...
Reply
#8

He used wrong loops, thats not ONLY 1 thing, now quit it. Also, he did "printf" wrong, so not 1 thing...
Reply
#9

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"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)