command(relato, playerid, params[]) {
new OtherPlayer, Name[24], Reason[128], Msg[128];
SendAdminText(playerid, "/relato", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Uso: \"/relato [id] [causa]");
else
{
if (APlayerData[OtherPlayer][LoggedIn] == true)
{
SendReportToAdmins(OtherPlayer, Reason);
GetPlayerName(OtherPlayer, Name, sizeof(Name));
format(Msg, 128, "Seu relato contra jogador(a) %s foi enviado aos administradores ", Name));
SendClientMessage(playerid, 0x808080FF, Msg);
if (AReports[0][ReportUsed] == true)
format(ReportList, 5000, "%s: %s - %s\n", AReports[0][ReportName], AReports[0][ReportReason], IsPlayerConnected(OtherPlayer) ? ("Online") : ("Offline"));
for (new i = 1; i < 50; i++)
{
if (AReports[i][ReportUsed] == true)
{
format(ReportList, 5000, "%s%s: %s - %s\n", ReportList, AReports[i][ReportName], AReports[i][ReportReason], IsPlayerConnected(i) ? ("Online") : ("Offline"));
}
}
ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_MSGBOX, "Relatуrio:", ReportList, "OK", "Cancelar");
}
else
SendClientMessage(playerid, 0xff000099, "ERRO:O jogador nao estб conectado.");
}
}
else
return 0;
return 1;
}
command(relato,playerid,params[])
{
new OtherPlayer,Name[24],Reason[128],Msg[145];
SendAdminText(playerid,"/relato",params);
if(APlayerData[playerid][LoggedIn] == true)
{
if(sscanf(params,"us[128]",OtherPlayer,Reason))return SendClientMessage(playerid,0xFF0000AA,"Uso: \"/relato [id] [causa]");
if(APlayerData[OtherPlayer][LoggedIn] == true)
{
SendReportToAdmins(OtherPlayer,Reason);
GetPlayerName(OtherPlayer,Name,sizeof Name);
format(Msg,sizeof Msg,"Seu relato contra jogador(a) %s foi enviado aos administradores",Name);
SendClientMessage(playerid,0x808080FF,Msg);
for(new i;i<50;i++)
{
if(AReports[i][ReportUsed] == true)
{
format(ReportList,5000,"%s%s: %s - %s\n",ReportList,AReports[i][ReportName],AReports[i][ReportReason],(IsPlayerConnect(i)) ? ("Online") : ("Offline"));
}
}
ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_MSGBOX, "Relatуrio:", ReportList, "OK", "Cancelar");
}
return SendClientMessage(playerid, 0xff000099, "ERRO:O jogador nao estб conectado.");
}
return 1;
}
command(relato,playerid,params[])
{
new OtherPlayer,Name[24],Reason[128],Msg[145];
SendAdminText(playerid,"/relato",params);
if(APlayerData[playerid][LoggedIn] == true)
{
if(sscanf(params,"us[128]",OtherPlayer,Reason))return SendClientMessage(playerid,0xFF0000AA,"Uso: \"/relato [id] [causa]");
if(APlayerData[OtherPlayer][LoggedIn] == true)
{
SendReportToAdmins(OtherPlayer,Reason);
GetPlayerName(OtherPlayer,Name,sizeof Name);
format(Msg,sizeof Msg,"Seu relato contra jogador(a) %s foi enviado aos administradores",Name);
SendClientMessage(playerid,0x808080FF,Msg);
for(new i;i<50;i++)
{
if(AReports[i][ReportUsed] == true)
{
format(ReportList,5000,"%s%s: %s - %s\n",ReportList,AReports[i][ReportName],AReports[i][ReportReason],(IsPlayerConnected(GetPlayerID(AReports[i][ReportName]))) ? ("Online") : ("Offline"));
}
}
ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_MSGBOX, "Relatуrio:", ReportList, "OK", "Cancelar");
}
return SendClientMessage(playerid, 0xff000099, "ERRO:O jogador nao estб conectado.");
}
return 1;
}
GetPlayerID(name[])//at the end of the script
{
new tmp[MAX_PLAYER_NAME];
for(new i;i<MAX_PLAYERS;i++)
{
if(!GetPlayerName(i,tmp,sizeof tmp))break;
if(!strcmp(name,tmp,true))return i;
}
return -1;
}
format(ReportList,5000,"%s%s: %s - %s\n"
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]
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])
{
format(ReportList,5000,"%s%s: %s - %s\n",ReportList,AReports[i][ReportName],AReports[i][ReportReason],(IsPlayerConnect(i)) ? ("Online") : ("Offline"));
strcat(dest, ReportList);
}
}
ShowPlayerDialog(playerid, DialogReports, DIALOG_STYLE_MSGBOX, "Relatуrio:", dest, "OK", "Cancelar");
return 1;
}
Why do you use "i"?
i has the value of sizeof(AReports) (50). You should use the playerid... - Mencent |
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;
}