23.07.2015, 20:29
PHP код:
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;
}