25.07.2015, 12:55
Quote:
Why do you use "i"?
i has the value of sizeof(AReports) (50). You should use the playerid... - Mencent |
pawn Code:
CMD:reportar(playerid, params[])
{
if(!APlayerData[playerid][LoggedIn]) return 0;
new OtherPlayer, Reason[128];
if (sscanf(params, "us[128]", OtherPlayer, Reason)) return SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/reportar <Player> <Seu Report>\"");
if (!APlayerData[OtherPlayer][LoggedIn]) return SendClientMessage(playerid, 0xFFFFFFFF, "O Player nao esta Online");
new Name[24], Msg[128];
SendReportToAdmins(OtherPlayer, Reason);
GetPlayerName(OtherPlayer, Name, sizeof(Name));
format(Msg, 128, "Voce Reportou {FFFFFF}%s", Name);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
return 1;
}
command(relato,playerid,params[])
{
SendAdminText(playerid,"/relato",params);
if(!APlayerData[playerid][LoggedIn]) return 0;
new OtherPlayer, Reason[128];
if(sscanf(params,"us[128]",OtherPlayer,Reason))return SendClientMessage(playerid,0xFF0000AA,"Uso: \"/relato [id] [causa]");
if(!APlayerData[OtherPlayer][LoggedIn]) return SendClientMessage(playerid, 0xff000099, "ERRO:O jogador nao estб conectado.");
SendReportToAdmins(OtherPlayer,Reason);
new Name[24], msg[128], dest[256], bool:OnlineState;
GetPlayerName(OtherPlayer,Name,sizeof Name);
format(msg,128,"Seu relato contra jogador(a) %s foi enviado aos administradores", Name);
SendClientMessage(playerid,0x808080FF,msg);
for(new i;i<sizeof(AReports);i++)
{
if(AReports[i][ReportUsed])
{
for(new p, j = GetPlayerPoolSize(); i<j; i++) if(IsPlayerConnected(p))
{
GetPlayerName(p, name, MAX_PLAYER_NAME);
if(!strcmp(name, AReports[i][ReportName])) OnlineState = true;
}
format(ReportList,5000,"%s%s: %s - %s
",ReportList,AReports[i][ReportName],AReports[i][ReportReason],(OnlineState) ? ("Online") : ("Offline"));
strcat(dest, ReportList);
OnlineState = false;
}
}
ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_MSGBOX, "Relatуrio:", dest, "OK", "Cancelar");
return 1;
}
This isn\'t the best way to do this though.