24.01.2018, 21:26
algum sistema de /duvida /responder para adms
forward MensagenParaAdmin(color,const string[]);
public MensagenParaAdmin(color,const string[])
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext,"/relatorio", true) == 0)
{
new texto=strval(cmdtext);
new string[256];
static nome[24];
GetPlayerName(playerid, nome, 24);
if(!strlen(cmdtext))return SendClientMessage(playerid, -1, "Use: /relatorio [Texto]");
else
{
format(string,256,"[Relatorio] %s: %s",nome,texto);
MensagemParaAdmin(-1,string);
}
return 1;
}
return 0;
}
forward MensagemParaAdmin(color,const string[]);
public MensagemParaAdmin(color,const string[])
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsPlayerAdmin(i))
{
SendClientMessage(i, color, string);
}
}
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256]; new idx; cmd = strtok(cmdtext, idx); if(strcmp(cmd, "/relatorio", true) == 0) { new string[256]; new mensagem[256]; new sendername[MAX_PLAYER_NAME]; mensagem = strtok(cmdtext, idx); if(!strlen(mensagem)) { SendClientMessage(playerid,-1,"Erro digite: /relatorio [texto]"); return 1; } GetPlayerName(playerid,sendername,sizeof(sendernam e)); format(string,sizeof(string),"Relatуrio de %s: %s",sendername,mensagem); AvisoAdmin(-1,string); return 1; } return 1; } |
forward AvisoAdmin(COLOR,const string[]); public AvisoAdmin(COLOR,const string[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if (IsPlayerAdmin(i)) { SendClientMessage(i, COLOR, string); } } } return 1; } |
strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } |
CMD:duvida(playerid, params[])
{
new duvida[200], string[200], pname[20];
if(sscanf(params, "s[200]", duvida)) return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Use: /duvida <texto>.");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(pAdmin[i] > 0)
{
GetPlayerName(playerid, pname, 20);
format(string, sizeof(string), "| DUVIDA | Dъvida recebida de %s(%d): %s", pname, playerid, duvida);
SendClientMessage(i, 0xFF0000AA, string);
}
}
SendClientMessage(playerid, 0xFFFFFFAA, "| DUVIDA | Dъvida enviada com sucesso para a Administraзгo. Aguarde!");
return 1;
}
CMD:responder(playerid, params[])
{
new resposta[200], string[200], pname[20], iname[20], id;
if(pAdmin[playerid] == 0) return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Vocк nгo tem permissгo para utilizar este comando.");
if(pAdmin[playerid] > 0)
{
if(sscanf(params, "us", id, resposta)) return SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Use: /responder <id> <resposta>.");
GetPlayerName(playerid, pname, 20);
GetPlayerName(id, iname, 20);
format(string, sizeof(string), "| DUVIDA | Resposta recebida de %s(%d): %s", pname, playerid, resposta);
SendClientMessage(id, 0xFF0000AA, string);
format(string, sizeof(string), "| DUVIDA | Resposta enviada para %s(%d): %s", iname, id, resposta);
SendClientMessage(playerid, 0xFF0000AA, string);
}
return 1;
}