Team Radio help
#1

pawn Код:
CMD:r(playerid, params[])
{
    if (params[0]) return SendClientMessage(playerid,COLOR_TAN,"Usage: /r [Message]");
    new pname[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(GetPlayerTeam(playerid == TEAM_BLUE))
    {
        format(string,sizeof (string), "Radio: %s: %s",pname, params);
        SendClientMessage(TEAM_BLUE, COLOR_TEAM_BLUE, string);
    }
    else if(GetPlayerTeam(playerid == TEAM_RED))
    {
        format(string, sizeof (string), "Radio: %s: %s",pname, params);
        SendClientMessage(TEAM_RED, COLOR_TEAM_RED, string);
    }
    return 1;
}
Thought i did this right, Guess not, It shows the usage, but if i type /r test it shows the usage again. I Know it has something to do with the params. Cant figure out what though.
Reply
#2

pawn Код:
if(!strlen(params)) return usagehere..
Reply
#3

pawn Код:
CMD:r(playerid, params[])
{
    if (sizeof(params) < 1) { SendClientMessage(playerid,COLOR_TAN,"Usage: /r [Message]"); return 1; }
    new pname[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(GetPlayerTeam(playerid == TEAM_BLUE))
    {
        format(string,sizeof (string), "Radio: %s: %s",pname, params);
        SendClientMessage(TEAM_BLUE, COLOR_TEAM_BLUE, string);
    }
    else if(GetPlayerTeam(playerid == TEAM_RED))
    {
        format(string, sizeof (string), "Radio: %s: %s",pname, params);
        SendClientMessage(TEAM_RED, COLOR_TEAM_RED, string);
    }
    return 1;
}
Reply
#4

Neither work fellas.
Reply
#5

pawn Код:
if(strlen(params) == 0) return
Works for me
Reply
#6

Doesnt for me, Usage doesnt even show up.
Reply
#7

I guess you use zcmd?
pawn Код:
if (isnull(params)) return SendClientMessage(playerid,COLOR_TAN,"Usage: /r [Message]");
Reply
#8

Yes, I'm using zcmd, And you sir were close, It shows the usage, but no message if i type /r message

I Think there's something wrong inside the formatted text. the "params" :S
Reply
#9

Thats because you did not put any playerid in the SendClientMessage code. You have TEAM_BLUE/TEAM_RED where it should be playerid.
Reply
#10

Yeah, it shows the message, but now, it shows to all teams. Lol. loop it through everyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)