SA-MP Forums Archive
Team Radio help - 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)
+--- Thread: Team Radio help (/showthread.php?tid=305044)



Team Radio help - -Rebel Son- - 21.12.2011

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.


Re: Team Radio help - iTorran - 21.12.2011

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



Re: Team Radio help - Rob_Maate - 21.12.2011

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;
}



Re: Team Radio help - -Rebel Son- - 21.12.2011

Neither work fellas.


Re: Team Radio help - iTorran - 21.12.2011

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


Re: Team Radio help - -Rebel Son- - 21.12.2011

Doesnt for me, Usage doesnt even show up.


Re: Team Radio help - Fj0rtizFredde - 21.12.2011

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



Re: Team Radio help - -Rebel Son- - 21.12.2011

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


Re: Team Radio help - Fj0rtizFredde - 21.12.2011

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


Re: Team Radio help - -Rebel Son- - 21.12.2011

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