SendClientMessage won't work. -
Gooday - 17.08.2012
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;
}
Re: SendClientMessage won't work. -
FalconX - 17.08.2012
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;
}
Re: SendClientMessage won't work. -
im - 17.08.2012
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..
Re: SendClientMessage won't work. -
Dan. - 17.08.2012
E:// Too late.
Re: SendClientMessage won't work. -
Gooday - 17.08.2012
Still not working guys
Same problem.
Re: SendClientMessage won't work. -
Dan. - 17.08.2012
Try changing the format line to:
pawn Код:
format(string, sizeof(string), "Report Message from: %s: %s", sendername, params[]);
Re: SendClientMessage won't work. -
JaKe Elite - 17.08.2012
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?