[SA:MP] Remote Console (RCON) BETA
Página 1 de 1
[SA:MP] Remote Console (RCON) BETA
Controle seu servidor de SA:MP Remotamente com essa poderosa ferramenta!
Imagens:
Download:
http://minus.com/mnGVN51MF/3
Agradecimentos:
- http://wiki.sa-mp.com/.
- Kmatsu_Br.
Créditos:
- http://wiki.sa-mp.com/ -- API para acesso RCON.
- Victor_Iron [victor.bsgmsn@hotmail.com] -- Produção do Software.
- Kmatsu_Br -- Idéia de como "ler" o chat remotamente e ajuda com o script Pawn.
Instalação:
. Crie os seguintes arquivos na pasta " scriptfiles ":
- LogKicks
- LogBans
- LogChat
- LogAdmChat
- LogComandos
- LogPars
. Descompacte os seguintes arquivos na pasta " filterscripts ":
- RCON.pwn
- RCON.amx
. Descompacte os seguintes arquivos onde desejar:
- SA-MP RCON R3.exe
. Altere os nomes e senhas do arquivo RCON.pwn e compile.
. Abra o SA-MP RCON R3.exe e digite as respectivas senhas e nicks.
. Digite no local para enviar comandos para a RCON: loadfs RCON.
. Deixe o número de linhas para "ler" para 5.
. Aperte " Enter ".
. Clique na CheckBox " Server Control ".
. Coloque o nick e senha que você definiu anteriormente.
. Clique em "Conectar".
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Licença Creative Commons" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Controle Remoto RCON SA:MP</span> de <a xmlns:cc="http://creativecommons.org/ns#" href="https://victor-iron-products.directorioforuns.com/" property="cc:attributionName" rel="cc:attributionURL">Victor_Iron, Kmatsu_Br</a> é licenciado sob uma <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Licença Creative Commons Atribuição-CompartilhaIgual 3.0 Não Adaptada</a>.
Imagens:
Download:
http://minus.com/mnGVN51MF/3
Agradecimentos:
- http://wiki.sa-mp.com/.
- Kmatsu_Br.
Créditos:
- http://wiki.sa-mp.com/ -- API para acesso RCON.
- Victor_Iron [victor.bsgmsn@hotmail.com] -- Produção do Software.
- Kmatsu_Br -- Idéia de como "ler" o chat remotamente e ajuda com o script Pawn.
Instalação:
. Crie os seguintes arquivos na pasta " scriptfiles ":
- LogKicks
- LogBans
- LogChat
- LogAdmChat
- LogComandos
- LogPars
. Descompacte os seguintes arquivos na pasta " filterscripts ":
- RCON.pwn
- RCON.amx
. Descompacte os seguintes arquivos onde desejar:
- SA-MP RCON R3.exe
. Altere os nomes e senhas do arquivo RCON.pwn e compile.
. Abra o SA-MP RCON R3.exe e digite as respectivas senhas e nicks.
. Digite no local para enviar comandos para a RCON: loadfs RCON.
. Deixe o número de linhas para "ler" para 5.
. Aperte " Enter ".
. Clique na CheckBox " Server Control ".
. Coloque o nick e senha que você definiu anteriormente.
. Clique em "Conectar".
- Código:
#include <a_samp>
enum nk
{
bool:aceito,
nick[30],
senha[30],
}
new UserTmp[nk];
public OnFilterScriptInit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
new ano, mes, dia, hora, minuto, segundo, piplog[24], stringlog[250];
GetPlayerIp(playerid, piplog, 24); getdate(ano, mes, dia); gettime(hora, minuto, segundo);
format(stringlog,sizeof(stringlog), "[CHAT] [%d/%d/%d][%d:%d:%d] %s[id %d][ip %s]: %s",dia, mes, ano, hora, minuto, segundo, PlayerName(playerid), playerid, piplog, text);
LogChat(stringlog);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new ano, mes, dia, hora, minuto, segundo, piplog[24], stringlog[250];
GetPlayerIp(playerid, piplog, 24); getdate(ano, mes, dia); gettime(hora, minuto, segundo);
format(stringlog,sizeof(stringlog), "[CMD] [%d/%d/%d][%d:%d:%d] %s[id %d][ip %s]: %s",dia, mes, ano, hora, minuto, segundo, PlayerName(playerid), playerid, piplog, cmdtext);
LogComando(stringlog);
if(strcmp(cmdtext, "/a", true)==0)
{
format(stringlog,sizeof(stringlog), "[ADM CHAT] [%d/%d/%d][%d:%d:%d] %s[id %d][ip %s]: %s",dia, mes, ano, hora, minuto, segundo, PlayerName(playerid), playerid, piplog, cmdtext);
LogAdmChat(stringlog);
return 1;
}
if(strfind(cmdtext, "/kick", true)!=-1)
{
format(stringlog,sizeof(stringlog), "[ADM KICK] [%d/%d/%d][%d:%d:%d] %s[id %d][ip %s]: %s",dia, mes, ano, hora, minuto, segundo, PlayerName(playerid), playerid, piplog, cmdtext);
LogKicks(stringlog);
return 1;
}
if(strfind(cmdtext, "/ban", true)!=-1)
{
format(stringlog,sizeof(stringlog), "[ADM BAN] [%d/%d/%d][%d:%d:%d] %s[id %d][ip %s]: %s",dia, mes, ano, hora, minuto, segundo, PlayerName(playerid), playerid, piplog, cmdtext);
LogBans(stringlog);
return 1;
}
if(strfind(cmdtext, "/par", true)!=-1 || strfind(cmdtext, "/pm", true)!=-1 || strfind(cmdtext, "/mp", true)!=-1)
{
format(stringlog,sizeof(stringlog), "[PRIVATE MSG] [%d/%d/%d][%d:%d:%d] %s[id %d][ip %s]: %s",dia, mes, ano, hora, minuto, segundo, PlayerName(playerid), playerid, piplog, cmdtext);
LogPars(stringlog);
return 1;
}
return 0;
}
public OnRconCommand(cmd[])
{
new cmdtext[200], idx, tmp[256];
cmdtext = strtok(cmd,idx);
if(strcmp(cmdtext, "comandos", true) == 0)
{
SendRconCommand("echo achat pm mensagem hora clima");
}
if(strcmp(cmdtext, "nick", true) == 0)
{
tmp = strrest(cmd,idx);
if(!strlen(tmp)) return printf("Invalid nick");
format(UserTmp[nick], 100, "%s", tmp);
}
if(strcmp(cmdtext, "pass", true) == 0)
{
tmp = strrest(cmd,idx);
if(!strlen(tmp)) return printf("Invalid password");
format(UserTmp[senha], 100, "%s", tmp);
}
if(strcmp(cmdtext, "autenticar", true) == 0)
{
Autenticar(true);
}
if(strcmp(cmdtext, "ListChat", true) == 0)
{
if(!Autenticar(false)) return 1;
new File: hFile = fopen("LogChat.log", io_read);
new buffer[256];
if(hFile)
{
while(fread(hFile,buffer))
{
print(buffer);
}
fclose(hFile);
}
}
if(strcmp(cmdtext, "ListAdmChat", true) == 0)
{
if(!Autenticar(false)) return 1;
new File: hFile = fopen("LogAdmChat.log", io_read);
new buffer[256];
if(hFile)
{
while(fread(hFile,buffer))
{
print(buffer);
}
fclose(hFile);
}
}
if(strcmp(cmdtext, "ListCmds", true) == 0)
{
if(!Autenticar(false)) return 1;
new File: hFile = fopen("LogComandos.log", io_read);
new buffer[256];
if(hFile)
{
while(fread(hFile,buffer))
{
print(buffer);
}
fclose(hFile);
}
}
if(strcmp(cmdtext, "ListKicks", true) == 0)
{
if(!Autenticar(false)) return 1;
new File: hFile = fopen("LogKicks.log", io_read);
new buffer[256];
if(hFile)
{
while(fread(hFile,buffer))
{
print(buffer);
}
fclose(hFile);
}
}
if(strcmp(cmdtext, "ListBans", true) == 0)
{
if(!Autenticar(false)) return 1;
new File: hFile = fopen("LogBans.log", io_read);
new buffer[256];
if(hFile)
{
while(fread(hFile,buffer))
{
print(buffer);
}
fclose(hFile);
}
}
if(strcmp(cmdtext, "ListPms", true) == 0)
{
if(!Autenticar(false)) return 1;
new File: hFile = fopen("LogPars.log", io_read);
new buffer[256];
if(hFile)
{
while(fread(hFile,buffer))
{
print(buffer);
}
fclose(hFile);
}
}
if(strcmp(cmdtext, "mensagem", true) == 0)
{
tmp = strrest(cmd,idx);
if(!strlen(tmp))
{
SendRconCommand("echo anunciar [mensagem]");
return 1;
}
new string[128];
SendClientMessageToAll(0xFF0000AA, "|_________________________ ADMIN REMOTO _______________________|");
format(string,sizeof(string), "Administrador Remoto AN: {FFFFFF}%s", tmp);
SendClientMessageToAll(0xFF00FFAA, string);
format(string,sizeof(string), "echo ADM REMOTO ANUNCIOU %s", tmp);
SendRconCommand(string);
}
if(strcmp(cmdtext, "pm", true) == 0)
{
tmp = strtok(cmd,idx);
if(!strlen(tmp))
{
SendRconCommand("echo pm [id] [mensagem]");
return 1;
}
new id = strval(tmp);
tmp = strrest(cmd,idx);
if(!strlen(tmp))
{
SendRconCommand("echo pm [id] [mensagem]");
return 1;
}
new string[128];
SendClientMessage(id, 0xFF0000AA, "|_________________________ ADMIN REMOTO _______________________|");
format(string,sizeof(string), "Administrador Remoto PM: {FFFFFF}%s", tmp);
SendClientMessage(id, 0xFF0A0FAA, string);
new n[24];
GetPlayerName(id, n, 24);
format(string,sizeof(string), "echo ADM REMOTO MANDOU PM PARA %s[%d]: %s", n, id, tmp);
SendRconCommand(string);
}
if(strcmp(cmdtext, "hora", true) == 0)
{
tmp = strtok(cmd,idx);
if(!strlen(tmp))
{
SendRconCommand("echo hora [HORA]");
return 1;
}
new string[128];
SendClientMessageToAll(0xFF0000AA, "|_________________________ ADMIN REMOTO _______________________|");
format(string,sizeof(string), "Administrador Remoto: setou a hora para %d", strval(tmp));
SendClientMessageToAll(0xFCFF0CAA, string);
SetWorldTime(strval(tmp));
format(string,sizeof(string), "echo ADM REMOTO SETOU HORA %d", strval(tmp));
SendRconCommand(string);
}
if(strcmp(cmdtext, "clima", true) == 0)
{
tmp = strtok(cmd,idx);
if(!strlen(tmp))
{
SendRconCommand("echo clima [CLIMA]");
return 1;
}
new string[128];
SendClientMessageToAll(0xFF0000AA, "|_________________________ ADMIN REMOTO _______________________|");
format(string,sizeof(string), "Administrador Remoto: setou o clima para %d", tmp);
SendClientMessageToAll(0xFFFF00AA, string);
SetWeather(strval(tmp));
format(string,sizeof(string), "echo ADM REMOTO SETOU CLIMA %d", tmp);
SendRconCommand(string);
}
if(strcmp(cmdtext, "achat", true) == 0)
{
tmp = strrest(cmd,idx);
if(!strlen(tmp))
{
SendRconCommand("echo achat [mensagem]");
return 1;
}
new string[128];
format(string,sizeof(string), "Administrador Remoto RCON CHAT: {FFFFFF}%s", tmp);
for(new i=0;i<MAX_PLAYERS;i++)
if(IsPlayerConnected(i))
SendClientMessage(i, 0xFF0000AA, " "),
SendClientMessage(i, 0xFF00FFAA, string);
format(string,sizeof(string), "echo ADM REMOTO RCON CHAT: %s", tmp);
SendRconCommand(string);
}
return 1;
}
stock 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;
}
stock strrest(const string[],index)
{
new length = strlen(string);
new offset = index;
new result[256];
while ((index < length) && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r'))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
forward LogComando(comando[]);
public LogComando(comando[])
{
new entry[256];
format(entry, sizeof(entry), "%s\r\n", comando);
new File: hFile = fopen("LogComando.log", io_append);
if(hFile)
{
fwrite(hFile, entry);
fclose(hFile);
}
}
forward LogChat(comando[]);
public LogChat(comando[])
{
new entry[256];
format(entry, sizeof(entry), "%s\r\n", comando);
new File: hFile = fopen("LogChat.log", io_append);
if(hFile)
{
fwrite(hFile, entry);
fclose(hFile);
}
}
forward LogPars(comando[]);
public LogPars(comando[])
{
new entry[256];
format(entry, sizeof(entry), "%s\r\n", comando);
new File: hFile = fopen("LogPars.log", io_append);
if(hFile)
{
fwrite(hFile, entry);
fclose(hFile);
}
}
forward LogAdmChat(comando[]);
public LogAdmChat(comando[])
{
new entry[256];
format(entry, sizeof(entry), "%s\r\n", comando);
new File: hFile = fopen("LogAdmChat.log", io_append);
if(hFile)
{
fwrite(hFile, entry);
fclose(hFile);
}
}
forward LogKicks(comando[]);
public LogKicks(comando[])
{
new entry[256];
format(entry, sizeof(entry), "%s\r\n", comando);
new File: hFile = fopen("LogKicks.log", io_append);
if(hFile)
{
fwrite(hFile, entry);
fclose(hFile);
}
}
forward LogBans(comando[]);
public LogBans(comando[])
{
new entry[256];
format(entry, sizeof(entry), "%s\r\n", comando);
new File: hFile = fopen("LogBans.log", io_append);
if(hFile)
{
fwrite(hFile, entry);
fclose(hFile);
}
}
new Users[][][] =
{
{" Victor_Iron", " 123456"},
{" Kmatsu_Br", " 123123"}
};
stock Autenticar(bool:printar)
{
for(new i = 0; i < sizeof(Users); i++)
{
if(strcmp(UserTmp[nick], Users[i][0], false) == 0 && strcmp(UserTmp[senha], Users[i][1], false) == 0)
{
if(printar)
{
printf("Auntenticado:%s:%s", UserTmp[nick], UserTmp[senha]);
return 1;
}
else
{
return 1;
}
}
}
printf("Nao Auntenticado:%s:%s", UserTmp[nick], UserTmp[senha]);
return 0;
}
stock PlayerName(p) { new n[24]; GetPlayerName(p,n,24); return n; }
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Licença Creative Commons" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">Controle Remoto RCON SA:MP</span> de <a xmlns:cc="http://creativecommons.org/ns#" href="https://victor-iron-products.directorioforuns.com/" property="cc:attributionName" rel="cc:attributionURL">Victor_Iron, Kmatsu_Br</a> é licenciado sob uma <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Licença Creative Commons Atribuição-CompartilhaIgual 3.0 Não Adaptada</a>.
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos