SA-MP Forums Archive
Radio cmd - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Radio cmd (/showthread.php?tid=257538)



Radio cmd - cruising - 26.05.2011

Hello!

trying to get this radio to work, but i cant get it to work properly.
The radio message is being send to all players and not within the teams, maybe someone have a idea to get it work? with

pawn Код:
COMMAND:r(playerid, params[])
{
    if (!strlen(params[0])) return SendClientMessage(playerid,White,"Usage: /r [Message]");
    new playername3[MAX_PLAYER_NAME],string[128];
    GetPlayerName(playerid,playername3,sizeof(playername3));
    new id;
    if(GetPlayerTeam(id) == 1)
    {
        if(Leader[id] == 1) format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessage(playerid,0xFF0000FF, String);
    }
    else if(GetPlayerTeam(id) == 1)
    {
        if(Member[id] == 1) format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessage(playerid,0xFF0000FF, String);
    }
    else if(Leader[id] == 2)
    {
        format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0xFFFF00AA,string);
    }
    else if(Member[id] == 2)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Leader[id] == 3)
    {
        format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0xFFFF00AA,string);
    }
    else if(Member[id] == 3)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Leader[id] == 0)
    {
        format(string,sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Member[id] == 0)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    return 1;
}
with
pawn Код:
SendClientMessage(playerid,
on all messages the text is invisible, but with
pawn Код:
SendClientMessageToAll
the text shown properly and to all players in the server, and that is not the meaning .


Re: Radio cmd - JaTochNietDan - 26.05.2011

Again I see this strange logic, people just creating variables called id or playerid, storing nothing in it, therefore it's defaulted at 0. Then using it to do important checks in the code. I'm not sure what you're trying to do here.

All this entire piece of code is actually doing, is this:

pawn Код:
if(GetPlayerTeam(0) == 1)
    {
        if(Leader[0] == 1) format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessage(playerid,0xFF0000FF, String);
    }
    else if(GetPlayerTeam(0) == 1)
    {
        if(Member[0] == 1) format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessage(playerid,0xFF0000FF, String);
    }
    else if(Leader[0] == 2)
    {
        format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0xFFFF00AA,string);
    }
    else if(Member[0] == 2)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Leader[0] == 3)
    {
        format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0xFFFF00AA,string);
    }
    else if(Member[0] == 3)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Leader[0] == 0)
    {
        format(string,sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Member[0] == 0)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
So if that's the case why do you create a variable at all in the first place?


Re: Radio cmd - cruising - 26.05.2011

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Again I see this strange logic, people just creating variables called id or playerid, storing nothing in it, therefore it's defaulted at 0. Then using it to do important checks in the code. I'm not sure what you're trying to do here.

All this entire piece of code is actually doing, is this:

pawn Код:
if(GetPlayerTeam(0) == 1)
    {
        if(Leader[0] == 1) format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessage(playerid,0xFF0000FF, String);
    }
    else if(GetPlayerTeam(0) == 1)
    {
        if(Member[0] == 1) format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessage(playerid,0xFF0000FF, String);
    }
    else if(Leader[0] == 2)
    {
        format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0xFFFF00AA,string);
    }
    else if(Member[0] == 2)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Leader[0] == 3)
    {
        format(string,sizeof (string), "** Command Chief Master  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0xFFFF00AA,string);
    }
    else if(Member[0] == 3)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Leader[0] == 0)
    {
        format(string,sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
    else if(Member[0] == 0)
    {
        format(string, sizeof (string), "** Member  %s: %s, over **",playername3, params[0]);
        SendClientMessageToAll(0x8F8F8FFF,string);
    }
So if that's the case why do you create a variable at all in the first place?
Sorry.. im not so good at scripting but trying my best.
So if you have any tips how to make this properly you are welcome to help me.
i need playerid or id to check who is typing the cmd and who is going to get the message?