PHP код:
#include <a_samp>
#include <dini>
new oldposx;
new oldposy;
new oldposz;
new cmd[256];
new sendername[MAX_PLAYER_NAME];
new idx;
new FicarRoco[MAX_PLAYERS];
new IP[45][] =
{
"189.1.169",
"35:7777",
"1.169.35",
"189.1",
"88",
"77",
"7777",
"7 7",
"8 8",
"189.1.169.35:7777",
"200.",
"200 .",
"189.",
"189 .",
"201.",
"201 .",
"200.1",
"200.1",
"200 . 1",
"200. 1",
"200 .1",
"201.1",
"201 . 1",
"201. 1",
"201 .1",
"208.1",
"208. 1",
"208 .1",
"208 . 1",
"69.1",
"69. 1",
"69 . 1",
"69 .1",
"189.1",
"189. 1",
"189 .1",
"189 . 1",
"66.7",
"66. 7",
"66 .7",
"66 . 7",
"177.1",
"177. 1",
"177 .1",
"177 . 1"
};
forward ProxDetector(Float:radi, playerid,params, col1,col2,col3,col4,col5);
//-----------------------------------------------------Login/Registo--------------------------------------------------//
new string[MAX_PLAYER_NAME];
#define DialogRegistro 696
#define DialogLogin 697
#define DialogSaidaA 698
#define DialogSaidaB 699
#define ContasPlayers "/ContasPlayers/%s.ini"
#define VALOR_MAXIMO_VIDA 90
#define VALOR_MAXIMO_COLETE 100
#define ATIVAR_CASE_SENSITIVE false
#define MAXIMO_TLOGAR 3
new TentativasDeLogar[MAX_PLAYERS];
new TotalMorreu[MAX_PLAYERS];
new TotalMatou[MAX_PLAYERS];
new nome[MAX_PLAYER_NAME];
new arquivo[44];
#if defined filterscript
main()
{
print("\n----------------------------------");
print(" Game Mode Criado Por: Alexandre");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
SetGameModeText("TH RPG");
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
//-----------------------------------------------------Login/Registo--------------------------------------------------//
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), ContasPlayers, nome);
if(!dini_Exists(arquivo))
{
format(string, sizeof(string), "Vocк ainda nгo possui registro em nosso servidor\n\nNome: %s\n\nInsira uma senha para registrar-se:", nome);
ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "[FLB] - Registro", string, "Registrar", "Sair");
return 0x1;
}
if(dini_Exists(arquivo))
{
TentativasDeLogar[playerid] = 0;
format(string, sizeof(string), "Vocк jб possui registro em nosso servidor\n\nNome: %s\n\nInsira sua senha para logar-se:", nome);
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "[FLB] - Login", string, "Logar", "Sair");
return 0x1;
}
//--------------------------------------------------------------------------------------------------------------------//
SetPlayerPos(playerid, 360.0244, -1458.8388, 9.22605);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
//-----------------------------------------------------Login/Registo--------------------------------------------------//
SalvarDadosPlayer(playerid);
//--------------------------------------------------------------------------------------------------------------------//
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
//-----------------------------------------------------Login/Registo--------------------------------------------------//
TotalMorreu[playerid] ++;
TotalMatou[killerid] ++;
//--------------------------------------------------------------------------------------------------------------------//
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
//----------------------------------[GRITAR]-----------------------------------------------
if(!strcmp(cmd, "/gritar", true) || !strcmp(cmd, "/g", true))
{
new j_String[0x80];
if(!IsPlayerConnected(playerid)) return 1;
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; }
new offset = idx, result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; }
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, 0xFF0000FF, "USO: (/g)ritar [local chat]");
if(FicarRoco[playerid] >= 5) return SendClientMessage(playerid,0xFF0000FF,"Vocк Estб Rouco! Vб atй uma farmбcia comprar Pastilha!."), SendClientMessage(playerid,0xFF0000FF,"OBS: A farmбcia fica em frente ao banco da cidade!.");
for(new i = 0x0; i < 6; ++i) {
if(strfind(result, IP[i], true) != -1)
{
result = "PКGO EM FRБGRANTE!!!Jogador tentando divulgar algum IP.";
}
}
format(j_String, sizeof(j_String), "%s Berra: %s!!", sendername, result);
FicarRoco[playerid]++;
printf("[chat] [grito] [%s] %s", sendername, result);
//ProxDetector(30.0, playerid, j_String,0xFF0000FF, 0xFF0000FF, 0xFF0000FF, 0xFF0000, 0xFF0000FF);
return 1;
}
//--------------------------------------------------------------------------------------------------------------------//
else return SendClientMessage(playerid, 0xFF0000AA, "O Comando Que Vocк Digitou Nгo Existe. Se Tiver Dъvidas Escreva '/Ajuda'.");
}
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()
{
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)
{
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[])
{
//-----------------------------------------------------Login/Registo--------------------------------------------------//
if(dialogid == DialogRegistro)
{
if(!response) ShowPlayerDialog(playerid, DialogSaidaA, DIALOG_STYLE_MSGBOX, "[FLB]Confirmar Saida", "Vocк ainda nгo estб registrado. Tem certeza que deseja sair ?", "Sair", "Voltar");
if(response)
{
if(strlen(inputtext) == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "Senha invбlida...Insira uma senha para que possa registrar !!");
format(string, sizeof(string), "Vocк ainda nгo possui registro em nosso servidor\n\nNome: %s\n\nInsira uma senha para registrar-se:", nome);
return ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "[FLB] - Registro", string, "Registrar", "Sair");
}
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), ContasPlayers, nome);
dini_Create(arquivo);
dini_Set(arquivo, "Senha", inputtext);
dini_IntSet(arquivo, "Dinheiro", 0);
dini_IntSet(arquivo, "Level", 0);
dini_IntSet(arquivo, "LevelProcurado", 0);
dini_IntSet(arquivo, "SkinPlayer", 0);
dini_FloatSet(arquivo, "Vida", VALOR_MAXIMO_VIDA);
dini_FloatSet(arquivo, "Colete", VALOR_MAXIMO_COLETE);
dini_IntSet(arquivo, "TotalMorreu", 0);
dini_IntSet(arquivo, "TotalMatou", 0);
SendClientMessage(playerid, 0xFFFFFFAA, "[FLB]Registro concluido com sucesso !!");
SpawnPlayer(playerid);
}
}
if(dialogid == DialogLogin)
{
if(!response) ShowPlayerDialog(playerid, DialogSaidaB, DIALOG_STYLE_MSGBOX, "[FLB]Confirmar Saida", "Vocк ainda nгo estб logado. Tem certeza que deseja sair ?", "Sair", "Voltar");
if(response)
{
if(strlen(inputtext) == 0)
{
SendClientMessage(playerid, 0xFF0000AA, "Senha invбlida...Insira uma senha para que possa logar !!");
format(string, sizeof(string), "Vocк jб possui registro em nosso servidor\n\nNome: %s\n\nInsira sua senha para logar-se:", nome);
return ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "[FLB] - Login", string, "Logar", "Sair");
}
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), ContasPlayers, nome);
if(!strcmp(inputtext, dini_Get(arquivo, "Senha"), ATIVAR_CASE_SENSITIVE))
{
SendClientMessage(playerid, 0xFFFFFFAA, "[FLB]Login efetuado com sucesso!!");
SpawnPlayer(playerid);
CarregarDadosPlayer(playerid);
}
else
{
TentativasDeLogar[playerid] ++;
if(TentativasDeLogar[playerid] < MAXIMO_TLOGAR)
{
SendClientMessage(playerid, 0xFF0000AA, "Senha INCORRETA !! Caso nгo acerte a senha vocк serб kickado por motivos de seguranзa !!");
format(string, sizeof(string), "Vocк jб possui registro em nosso servidor\n\nNome: %s\n\nInsira sua senha para logar-se:", nome);
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "[FLB] - Login", string, "Logar", "Sair");
return 0x1;
}
if(TentativasDeLogar[playerid] >= MAXIMO_TLOGAR)
{
SendClientMessage(playerid, 0xFF0000AA, "Vocк nгo acertou a senha em um numero maximo de tentativas. Por isto foi kickado");
Kick(playerid);
return 0x1;
}
}
}
}
if(dialogid == DialogSaidaA)
{
if(response)
{
SendClientMessage(playerid, 0xFF0000AA, "Vocк decidiu sair do servidor sem se registrar !! Volte Sempre...");
Kick(playerid);
}
else
{
format(string, sizeof(string), "Vocк ainda nгo possui registro em nosso servidor\n\nNome: %s\n\nInsira uma senha para registrar-se:", nome);
ShowPlayerDialog(playerid, DialogRegistro, DIALOG_STYLE_INPUT, "[FLB] - Registro", string, "Registrar", "Sair");
}
}
if(dialogid == DialogSaidaB)
{
if(response)
{
SendClientMessage(playerid, 0xFF0000AA, "Vocк decidiu sair do servidor sem se logar !! Volte Sempre...");
Kick(playerid);
}
else
{
format(string, sizeof(string), "Vocк jб possui registro em nosso servidor\n\nNome: %s\n\nInsira sua senha para logar-se:", nome);
ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, "[FLB] - Login", string, "Logar", "Sair");
}
}
//--------------------------------------------------------------------------------------------------------------------//
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
public ProxDetector(Float:radi, playerid, params,col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:x, Float:y, Float:z;
new Float:tempposx, Float:tempposy, Float:tempposz;
new Float: posx, posy, posz;
GetPlayerPos(playerid,x, y, z);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(playerid, x, y, z);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, string);
}
//else if (((tempposx < radi/3) && (tempposx > -radi/3) && ((tempposy < radi/3) && (tempposy > -radi/3) && ((tempposz < radi/3) && (tempposz > -radi/3))
//{
//SendClientMessage(i, col2, string);
//}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, string);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, string);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, string);
}
}
else
{
SendClientMessage(i, col1, string);
}
}
}
return 1;
}
stock SalvarDadosPlayer(playerid)
{
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), ContasPlayers, nome);
if(!dini_Exists(arquivo)) dini_Create(arquivo);
new Float:Vida, Float:Colete;
GetPlayerHealth(playerid, Vida);
GetPlayerArmour(playerid, Colete);
dini_IntSet(arquivo, "Dinheiro", GetPlayerMoney(playerid));
dini_IntSet(arquivo, "Level", GetPlayerScore(playerid));
dini_IntSet(arquivo, "LevelProcurado", GetPlayerWantedLevel(playerid));
dini_IntSet(arquivo, "SkinPlayer", GetPlayerSkin(playerid));
dini_FloatSet(arquivo, "Vida", Vida);
dini_FloatSet(arquivo, "Colete", Colete);
dini_IntSet(arquivo, "TotalMorreu", TotalMorreu[playerid]);
dini_IntSet(arquivo, "TotalMatou", TotalMatou[playerid]);
return 0x1;
}
stock CarregarDadosPlayer(playerid)
{
GetPlayerName(playerid, nome, sizeof(nome));
format(arquivo, sizeof(arquivo), ContasPlayers, nome);
if(!dini_Exists(arquivo)) return 0x1;
GivePlayerMoney(playerid, dini_Int(arquivo, "Dinheiro"));
SetPlayerScore(playerid, dini_Int(arquivo, "Level"));
SetPlayerWantedLevel(playerid, dini_Int(arquivo, "LevelProcurado"));
SetPlayerSkin(playerid, dini_Int(arquivo, "SkinPlayer"));
SetPlayerHealth(playerid, dini_Float(arquivo, "Vida"));
SetPlayerArmour(playerid, dini_Float(arquivo, "Colete"));
TotalMorreu[playerid] = dini_Int(arquivo, "TotalMorreu");
TotalMatou[playerid] = dini_Int(arquivo, "TotalMatou");
return 0x1;
}