SendClientMessage won't work.
#1

Hey guys, I've got a problem with this command, when I send the report I only see: Your report message has been sent even if I'm admin I can't see the Report Message.

pawn Код:
CMD:report(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME], string[128];
    if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /report [Message Here]");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    strreplace(sendername, '_', ' ');
    SendClientMessage(playerid, COLOR_GOLD, "Your report message has been sent to all the online Administrators.");
    if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1)
    {
    format(string, sizeof(string), "Report Message from: %s: %s", sendername, params);
    SendClientMessageToAll(COLOR_GOLD, string);
    }
    return 1;
}
Reply
#2

pawn Код:
CMD:report(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME], string[128];
    if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /report [Message Here]");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    strreplace(sendername, '_', ' ');
    SendClientMessage(playerid, COLOR_GOLD, "Your report message has been sent to all the online Administrators.");
   
    format(string, sizeof(string), "Report Message from: %s: %s", sendername, params);
    SendMessageToAdmins( COLOR_GOLD, string );
    return 1;
}

stock SendMessageToAdmins( color, text[ ] )
{
    for( new f = 0; f < MAX_PLAYERS; f++ )
    {
        if( IsPlayerConnected( f ) )
        {
            if(IsPlayerAdmin(f) || PlayerInfo[f][pAdminLevel] >= 1)
            {
                SendClientMessage( f, color, text );
            }
        }
    }
    return 1;
}
Reply
#3

pawn Код:
CMD:report(playerid, params[])
{
    new sendername[MAX_PLAYER_NAME], string[128];
    if(isnull(params)) return SendClientMessage(playerid, COLOR_LIGHTBLUE,"[SYNTAX]: /report [Message Here]");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    strreplace(sendername, '_', ' ');
    SendClientMessage(playerid, COLOR_GOLD, "Your report message has been sent to all the online Administrators.");
    format(string, sizeof(string), "Report Message from: %s: %s", sendername, params);
        new i;
    for(i=0; i < MAX_PLAYERS; i++){
        if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1) SendClientMessage(i, COLOR_GOLD, string);    
    }
    return 1;
}
//too late..
Reply
#4

E:// Too late.
Reply
#5

Still not working guys Same problem.
Reply
#6

Try changing the format line to:

pawn Код:
format(string, sizeof(string), "Report Message from: %s: %s", sendername, params[]);
Reply
#7

Uhm one note.

pawn Код:
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdminLevel] >= 1)
    {
    format(string, sizeof(string), "Report Message from: %s: %s", sendername, params);
    SendClientMessageToAll(COLOR_GOLD, string);
    }
this is wrong, plus it will be sent to all players. Your code is epic fail.
You need to loop it, then check if the players are admin, if they are admin send it to them.
Simple. Are you using foreach or normal loop?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)