Код:
// Naruto RPG Storm
#include <a_samp>
#include <dof2>
#include <dini>
#include <a_http>
#include <mailer>
#define MAILER_URL "geradoresjfs.site90.net/mailer.php" // Arquivo .php
#define CONTAS \
"Contas/%s.ini"
#define REGISTRO \
(787)
#define LOGIN \
(790)
#define MAX_PLAYERS \
(50) // Slots do servidor
#define DinheiroInicial \
(100) // Dinheiro inicial
#define NivelInicial \
(1) // Nнvel inicial
#define EmailServidor \
("jonathan_feitosa@hotmail.com.br") // E-mail do servidor
#define NomeServidor \
("Naruto RPG Storm - Recuperaзгo de senha") // Nome do servidor
new
Invalido[MAX_PLAYERS],
PlayerName[MAX_PLAYER_NAME],
String[128],
Matou[MAX_PLAYERS],
Morreu[MAX_PLAYERS],
Nivel[MAX_PLAYERS],
Logou[MAX_PLAYERS],
Ano[MAX_PLAYERS],
Mes[MAX_PLAYERS],
Hora[MAX_PLAYERS],
Dia[MAX_PLAYERS],
Minuto[MAX_PLAYERS],
PrimeiraVez[MAX_PLAYERS]
;
// Sistema de Chakra
new Bar:Chakra[MAX_PLAYERS];
new GanharChakra[MAX_PLAYERS];
//----------------------------------------------------------------------------//
main()
{
print("Servidor ligado.");
}
public OnGameModeInit()
{
SetGameModeText("Naruto RPG Storm");
SendRconCommand("mapname Mundo Shinobi");
UsePlayerPedAnims();
DisableInteriorEnterExits();
LimitGlobalChatRadius(10.0);
ShowPlayerMarkers(0);
ShowNameTags(1);
EnableStuntBonusForAll(0);
if(!fexist("Skins.ini")) dini_Create("Skins.ini");
if(!fexist("Cores.ini")) dini_Create("Cores.ini");
AddPlayerClass(1,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(2,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(3,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(4,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(5,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(6,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(7,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(8,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(9,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(10,236.9795,3404.3882,22.5313,178.8385,0,0,0,0,0,0);
AddPlayerClass(11,236.9795,3404.3882,22.5313,178.8385,0,0,0,0,0,0);
AddPlayerClass(12,236.9795,3404.3882,22.5313,178.8385,0,0,0,0,0,0);
AddPlayerClass(13,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(14,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(15,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(16,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
AddPlayerClass(21,-1900.3501,-2876.0957,29.1000,155.9835,0,0,0,0,0,0);
return 1;
}
public OnGameModeExit()
{
for(new i=0; i<MAX_PLAYERS; ++i) SalvarPlayer(i);
DOF2_Exit();
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid,1025.5751,-2140.7637,39.2032); // Jogador
SetPlayerCameraPos(playerid,1019.7552,-2141.0266,37.7274); // Cвmera
SetPlayerCameraLookAt(playerid,1021.9974,-2140.9907,38.3012); // Cвmera
SetPlayerFacingAngle(playerid, 82.6125); // Вngulo
ApplyAnimation(playerid, "PARK", "Tai_Chi_Loop", 4.0, 1, 0, 0, 0, 0); // Animaзгo
return 1;
}
public OnPlayerConnect(playerid)
{
Chakra[playerid] = CreateProgressBar(501.00, 104.00, 103.50, 7.50, 65535, 1000.0);
ShowProgressBarForPlayer(playerid,Chakra[playerid]);
SetProgressBarValue(Chakra[playerid],1000);
UpdateProgressBar(Chakra[playerid], playerid);
ApplyAnimation(playerid,"AIRPORT", "thrw_barl_thrw", 1.0, 0, 0, 0, 0, 0);
ApplyAnimation(playerid,"AIRPORT", "thrw_barl_thrw", 1.0, 0, 0, 0, 0, 0);
GanharChakra[playerid] = SetTimerEx("GanharChakra", 1000, false, "i", playerid);
if(strfind(PlayerName(playerid),"clock$",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"prn",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"con",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"nul",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"aux",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com1",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com2",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com3",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com4",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com5",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com6",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com7",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com8",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"com9",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"lpt1",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"lpt2",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"lpt3",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"lpt4",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"lpt5",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"lpt6",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"lpt8",true) != -1) Ban(playerid);
if(strfind(PlayerName(playerid),"lpt9",true) != -1) Ban(playerid);
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String), CONTAS, PlayerName);
if(!DOF2_FileExists(String))
{
format(String, sizeof(String), "\n{999999}Conta: {FFFFFF}%s\n{999999}Status: {FF0000}Nгo registrada\n\n{FFFFFF}Digite uma senha para registrar sua conta.\n", PlayerName);
ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "Registro", String, "Registrar", "Cancelar");
}
else format(String, sizeof(String), "\n{999999}Conta: {FFFFFF}%s\n{999999}Status: {00FF00}Registrado\n\n{FFFFFF}Digite sua senha corretamente para logar-se.\n", PlayerName);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
dini_IntSet("Cores.ini",PlayerName(playerid),GetPlayerColor(playerid));
dini_IntSet("Skins.ini",PlayerName(playerid),GetPlayerSkin(playerid));
DOF2_Exit();
SalvarPlayer(playerid);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(dini_Isset("Skins.ini",PlayerName(playerid))) SetPlayerSkin(playerid,dini_Int("Skins.ini",PlayerName(playerid)));
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid))
{
Matou[killerid] ++;
Nivel[killerid] ++;
}
if(IsPlayerConnected(playerid))
{
Morreu[playerid] ++;
Nivel[playerid] --;
}
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(65536))
{
SendClientMessage(playerid, -1, "Vocк estб carregando seu chakra.");
new Float:h;
h = GetProgressBarValue(chakra[playerid]);
SetProgressBarValue(chakra[playerid],h+2);
UpdateProgressBar(chakra[playerid],playerid);
}
else if(RELEASED(65536))
{
SendClientMessage(playerid, -1, "Vocк deixou de carregar seu chakra.");
}
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == REGISTRO)
{
if(response)
{
if(!strlen(inputtext))
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String), "\n{999999}Conta: {FFFFFF}%s\n{999999}Status: {FF0000}Nгo registrada\n\n{FFFFFF}Digite uma senha para registrar sua conta.\n", PlayerName);
ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "Registro", String, "Registrar", "Cancelar");
return true;
}
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String), CONTAS, PlayerName);
DOF2_CreateFile(String);
DOF2_SetString(String,"Senha", inputtext);
DOF2_SetString(String,"Email","Email desconfigurado");
DOF2_SetInt(String,"Dinheiro", DinheiroInicial);
DOF2_SetInt(String,"Nнvel", NivelInicial);
DOF2_SetInt(String,"Matou", 0);
DOF2_SetInt(String,"Morreu", 0);
DOF2_SetInt(String,"Admin", 0);
DOF2_SetInt(String,"Logou", 0);
DOF2_SetInt(String, "Ano", 0);
DOF2_SetInt(String, "Mкs", 0);
DOF2_SetInt(String, "Dia", 0);
DOF2_SetInt(String, "Hora", 0);
DOF2_SetInt(String, "Minuto", 0);
DOF2_SaveFile();
ShowPlayerDialog(playerid, 6783, DIALOG_STYLE_INPUT, "Email", "\n\n{FFFFFF}Digite seu email abaixo para terminar o registro.\n\n{FF0000}PS: {FFFFFF}Caso perca sua senha, usarб para recuperб-la.\n\n", "Confirmar", "");
return true;
}
else
{
Kick(playerid);
return true;
}
}
if(dialogid == 6783)
{
if(response)
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String), CONTAS, PlayerName);
DOF2_SetString(String,"Email", inputtext);
DOF2_SaveFile();
format(String, sizeof(String), "Email configurado para: %s", DOF2_GetString(String,"Email"));
SendClientMessage(playerid, -1, String);
Registrando(playerid);
return true;
}
}
if(dialogid == 6784)
{
if(response)
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String), CONTAS, PlayerName);
static Celula[300];
format(Celula, sizeof(Celula),
"Recuperaзгo de senha\nNova senha: %s\n\n\nAtenciosamente,\nEquipe NRPGS", DOF2_GetString(String,"Senha"));
SendMail(DOF2_GetString(String,"Email"), EmailServidor, NomeServidor, "Recuperaзгo de senha", Celula);
SendClientMessage(playerid, -1, "Um email com sua senha foi enviado para seu email com sucesso.");
SendClientMessage(playerid, -1, "PS: As vezes pode demorar cerca de 5 minutos.");
Kick(playerid);
}
else
{
Kick(playerid);
}
return true;
}
if(dialogid == LOGIN)
{
if(response)
{
if(!strlen(inputtext))
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String),
"\n{999999}Conta: {FFFFFF}%s\n{999999}Status: {00FF00}Registrado\n\n{FFFFFF}Digite sua senha corretamente para logar-se.\n", PlayerName);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
SendClientMessage(playerid, -1, "Campo em branco, digite sua senha corretamente.");
return true;
}
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String), CONTAS, PlayerName);
if(!strcmp(inputtext,DOF2_GetString(String,"Senha"),false))
{
Logando(playerid);
return true;
}
else
{
Invalido[playerid] += 1;
if(Invalido[playerid] == 5)
return ShowPlayerDialog(playerid, 6784, DIALOG_STYLE_MSGBOX, "Recuperaзгo de senha", "\n\n{FFFFFF}Clique em 'Enviar' para enviar um email para o seu email contendo sua senha.\n\n", "Enviar", "Cancelar");
SendClientMessage(playerid, -1, "Senha incorreta, se errar 5 vezes terб que recuperar-lб por email.");
format(String, sizeof(String),
"\n{999999}Conta: {FFFFFF}%s\n{999999}Status: {00FF00}Registrado\n\n{FFFFFF}Digite sua senha corretamente para logar-se.\n", PlayerName);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
}
return true;
}
else
{
Kick(playerid);
return true;
}
}
return 1;
}
stock SalvarPlayer(playerid)
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String), CONTAS, PlayerName);
DOF2_SetInt(String,"Dinheiro", GetPlayerMoney(playerid));
DOF2_SetInt(String,"Nнvel", Nivel[playerid]);
DOF2_SetInt(String,"Matou", Matou[playerid]);
DOF2_SetInt(String,"Morreu", Morreu[playerid]);
DOF2_SetInt(String,"Logou", Logou[playerid]);
getdate(Ano[playerid], Mes[playerid], Dia[playerid]);
gettime(Hora[playerid], Minuto[playerid]);
DOF2_SetInt(String, "Minuto", Minuto[playerid]);
DOF2_SetInt(String, "Hora", Hora[playerid]);
DOF2_SetInt(String, "Dia", Dia[playerid]);
DOF2_SetInt(String, "Mкs", Mes[playerid]);
DOF2_SetInt(String, "Ano", Ano[playerid]);
DOF2_SaveFile();
return true;
}
stock CarregarPlayer(playerid)
{
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(String, sizeof(String), CONTAS, PlayerName);
GivePlayerMoney(playerid, DOF2_GetInt(String,"Dinheiro"));
Nivel[playerid] = DOF2_GetInt(String, "Nнvel");
Matou[playerid] = DOF2_GetInt(String, "Matou");
Morreu[playerid] = DOF2_GetInt(String, "Morreu");
Logou[playerid] = DOF2_GetInt(String, "Logou");
DOF2_GetString(String, "Email");
Minuto[playerid] = DOF2_GetInt(String, "Minuto");
Hora[playerid] = DOF2_GetInt(String, "Hora");
Dia[playerid] = DOF2_GetInt(String, "Dia");
Mes[playerid] = DOF2_GetInt(String, "Mкs");
Ano[playerid] = DOF2_GetInt(String, "Ano");
DOF2_SaveFile();
return true;
}
stock Logando(playerid)
{
CarregarPlayer(playerid);
Logou[playerid] += 1;
if(PrimeiraVez[playerid] != 1)
{
format(String, sizeof(String), "Seu ъltimo login foi dia: %d/%d/%d аs %d horas e %d minutos.", Dia[playerid], Mes[playerid], Ano[playerid], Hora[playerid], Minuto[playerid]);
}
else SendClientMessage(playerid, -1, "Bem vindo ao servidor pela primeira vez, agradeзemos sua preferкncia."
PrimeiraVez[playerid] = 0;
// Funзхes quando o player estб logando.
return true;
}
stock Registrando(playerid)
{
// Funзхes quando o Player estiver se registrando pela primeira vez.
PrimeiraVez[playerid] = 1;
format(String, sizeof(String), "\n{999999}Conta: {FFFFFF}%s\n{999999}Status: {00FF00}Registrado\n\n{FFFFFF}Digite sua senha corretamente para logar-se.\n", PlayerName);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
return true;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
//----------------------------------------------------------------------------//
CMD:carregarchakra(playerid, params[])
{
new Float:h;
h = GetProgressBarValue(Chakra[playerid]);
SetProgressBarValue(Chakra[playerid],h+50);
UpdateProgressBar(Chakra[playerid], playerid);
SendClientMessage(playerid, -1, "Vocк estб carregando seu chakra.");
return 1;
}