Help in an /r cmd. Not working as it should.
#1

Hello. My /r cmd work, and all cop ranks can use, but only the leader see the radio chat.. We use,a nd don't see or receive anything...

pawn Код:
CMD:r(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][Fmember] == 1 || PlayerInfo[i][Fleader] == 1)
        {
            new text[258];
            if(!sscanf(params, "s", text))
            {
                new name[MAX_PLAYER_NAME], string[258];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "%s (radio): %s , Over.", name, text);
                SendClientMessage(i, TEAM_RADIO_COLOR, string);
                return 1;
            }
            else return SendClientMessage(playerid, COLOR_RED, "USAGE: /r [Text]");
        }
    }
    return 0;
}
Thank you.
Reply
#2

Maybe make it so that u use Fmember for Fleader aswell.. So u dont need 2 if(playerinfo
Reply
#3

Hum.. It's hard because i have to change the whole system.
Reply
#4

Is it ment to check if Hes member AND leader? since this is what it does
Edit why are you using sscanf so weird?
pawn Код:
CMD:r(playerid, params[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][Fmember] == 1 || PlayerInfo[i][Fleader] == 1)
        {
            new text[258];
            if(sscanf(params, "s", text)) SendClientMessage(playerid, COLOR_RED, "USAGE: /r [Text]");
            {
                new name[MAX_PLAYER_NAME], string[258];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "%s (radio): %s , Over.", name, text);
                SendClientMessage(i, TEAM_RADIO_COLOR, string);
                return 1;
            }
         }
    }
    return 0;
}
Reply
#5

PHP код:
forward SendLAWMessage(color,const string[]);
public 
SendLAWMessage(color,const string[])
{
    for(new 
0MAX_PLAYERSi++)
    {
    if(
IsPlayerConnected(i) == 1)
    if(
PlayerInfo[i][Fmember] < || PlayerInfo[i][Fleader] < 1)
    
SendClientMessage(iTEAM_RADIO_COLOR,string);
    }
    return 
1;
}
CMD:rplayeridparams[ ] )
{
    if(
PlayerInfo[i][Fmember] < || PlayerInfo[i][Fleader] < 1)) return 0;
    new 
string[258];
    if( 
sscanf(params,"u"string ) ) return SendClientMessage(playeridCOLOR_RED"USAGE: /r [Text]");
                new 
name[MAX_PLAYER_NAME], string[258];
                
GetPlayerName(playeridnamesizeof(name));
                
format(stringsizeof(string), "%s (radio): %s , Over."nameparams);
    
SendLAWMessage(TEAM_RADIO_COLORstring);
    return 
1;

Reply
#6

pawn Код:
SendClientMessage(i, TEAM_RADIO_COLOR, string);
??.. You' want to send the chat to the whole group right?

Edit: bogdan was quicker.. Lol
Reply
#7

Supreme thats what the sendclientmessage does.... Since i is defined as the cop group
Reply
#8

Quote:
Originally Posted by thimo
Посмотреть сообщение
Supreme thats what the sendclientmessage does.... Since i is defined as the cop group
See bogdan1992's post... thats how you define the cop group..
Reply
#9

Ricardo, did it work?
If yes, would you like to give me a reputation point please .
Reply
#10

Quote:
Originally Posted by Bogdan1992
Посмотреть сообщение
Ricardo, did it work?
If yes, would you like to give me a reputation point please .
Don't beg for Rep..
pawn Код:
CMD:r(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /r [Text]");
    foreach(Player, i) {
        if(PlayerInfo[i][Fmember] == 1 || PlayerInfo[i][Fleader] == 1) {
            new
                string[ 128 ], name[ MAX_PLAYER_NAME ];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "%s (radio): %s , Over.", name, params);
            SendClientMessage(i, TEAM_RADIO_COLOR, string);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)