23.01.2010, 01:54
Quote:
Originally Posted by LuCaS_
Quote:
//mudando de asunto.... ae, como eu faзo um comando /reportar [texto], que quando o player usa o texto й mandado para os admins logados na RCON? |
pawn Code:
if(strcmp(cmd, "/reportar", true) == 0)
{
new giveplayerid;
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new string[256];
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, cinza, "Uso: /reportar [id] [motivo]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, cinza, "Uso: /reportar [id] [motivo]");
return 1;
}
for(new i=0; i<MAX_PLAYERS; i++){
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "~ [Atenзгo ADM's]: %s reportou %s, [Motivo: %s]", sendername, giveplayer, (result),month,day,year);
if(IsPlayerAdmin(i) == 1){
SendClientMessage(i, cinza, string);
}}
return 1;
}
}
SendClientMessage(playerid, cinza, "Jogador nгo conectado!");
}
return 1;
}