Code:
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <file>
#include <utils>
#include <morphinc>
#include <cpstream>
#include <Y_Objects>
static gTeam[MAX_PLAYERS];
#pragma tabsize 0
#define SCRIPT_VERSION "GAMER-X [RPG]"
#define SPECIAL_ACTION_PISSING2 68
#define VERDE 0x33AA33AA
#define VERDE2 0x00D900C8
#define PRETO 0x000000FF
#define AZUL 0x2641FEAA
#define AZUL2 0x8080FF96
#define AZUL3 0x33CCFFAA
#define ROXO 0xC2A2DAAA
#define AMARELO 0xFFFF00AA
#define VERMELHO 0x9D000096
#define VERMELHO1 0xFF6347AA
#define COLOR_RADIO2 0xCD6CF6F6
#define COLOR_DEPARTAMENTO 0x50C480F6
#define CINZA 0xAFAFAFAA
#define CINZA1 0xB4B5B7FF
#define CINZA2 0xBFC0C2FF
#define CINZA3 0xCBCCCEFF
#define CINZA4 0xD8D8D8FF
#define CINZA5 0xE3E3E3FF
#define CINZA6 0xF0F0F0FF
#define TextColor "~p~"
#define TextColor2 "~n~"
#define VICTOR 69
#define SLOTS 200
#define KEY_HORN 2
#define MAX_STRING 255
#define CHECKPOINT_Nenhum 0
#define CHECKPOINT_HOME 12
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_ALLDEPT 0xFF8282AA
#define COLOR_NEWS 0xFFA500AA
#define COLOR_OOC 0xE0FFFFAA
#define TEAM_CYAN 1
#define TEAM_BLUE 2
#define TEAM_GREEN 3
#define TEAM_orANGE 4
#define TEAM_Cor 5
#define TEAM_BAR 6
#define TEAM_TAT 7
#define TEAM_CUN 8
#define TEAM_STR 9
#define TEAM_HIT 10
#define TEAM_ADMIN 11
#define PS 21
#define MLH 22
#define OBJECTIVE_COLOR 0x64000064
#define TEAM_GREEN_COLOR 0x33AA33AA
#define TEAM_Emprego_COLOR 0xFFB6C1AA
#define TEAM_HIT_COLOR 0xFFFFFF00
#define TEAM_BLUE_COLOR 0x8D8DFF00
#define COLOR_ADD 0x63FF60AA
#define TEAM_GROVE_COLOR 0x00D900C8
#define TEAM_GROVE_COLOR2 0x00D900C8
#define TEAM_VAGOS_COLOR 0xFFC801C8
#define TEAM_BALLAS_COLOR 0xD900D3C8
#define TEAM_AZTECAS_COLOR 0x2641FEC8
#define TEAM_CYAN_COLOR 0xA92BF6F6
#define TEAM_orANGE_COLOR 0xFF830000
#define TEAM_Cor_COLOR 0x39393900
#define TEAM_BAR_COLOR 0x00D90000
#define TEAM_TAT_COLOR 0xBDCB9200
#define TEAM_CUN_COLOR 0xD900D300
#define TEAM_STR_COLOR 0x01FCFF00
#define TEAM_ADMIN_COLOR 0x00808000
#define COLOR_INVIS 0xAFAFAF00
#define COLOR_SPEC 0xBFC0C200
#define TEAM_BOPE_COLOR 0x0000FF
#define TEAM_TBOPE_COLOR 0x030303AA
#define TEAM_GBOPE_COLOR 0x030303C8
#define GMOB 0xF60000C8
#define COLOR_MSG 0x934FF6F6
#define COLOR_HAMAS 0xF4005BF6
#define COLOR_TAXISTA 0xF68E00F6
#define COLOR_ASSASSINOS 0xBFC0C200
#define COLOR_BLACK 0x000000AA
#define AN_COLOR 0x00E7C6F6
#define COP_COLOR3 0x5EB7E3F6
#define COP_COLOR2 0xCD6CF6F6
#define COP_COLOR 0x7491F6F6
#define GCOP_COLOR 0x6666FFC8
#define COLOR_ALCAIDA 0x685000F6
#define CAR_AMOUNT 590 //Andrй й GAY ;D
#define CAR_RESPAW 589 // menos 1 do CAR_AMOUNT
/*x---------------------------------Login Box-------------------------------------x*/
enum aInfo
{
aPassword[128],
aLogged,
};
new AccountInfo[MAX_PLAYERS][aInfo];
public OnGameModeInit()
{
SendRconCommand("reloadfs Seifistration");
return 1;
}
public OnPlayerConnect(playerid)
{
AccountInfo[playerid][aLogged] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
OnPlayerUpdate(playerid);
AccountInfo[playerid][aLogged] = 0;
register[playerid] = 0;
login[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new string[128];
format(string, sizeof(string), ACCOUNTS_FOLDER, name);
if (AccountInfo[playerid][aLogged] == 0)
{
if (!fexist(string))
{
new kayitmsg[256];
format(kayitmsg,256,"Bem Vindo ao Brasil One Life\n\n%s Voce^ na~o estб registrado\n\nDigite uma senha:",name);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",kayitmsg,"Register","Quit");
register[playerid] = 1;
login[playerid] = 0;
}
else if (fexist(string))
{
new girismsg[256];
format(girismsg,256,"Bem Vindo ao Brasil One Life\n\nUser Name: %s\n\nEntre com sua senha:",name);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
register[playerid] = 0;
login[playerid] = 1;
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (response == 1)
{
if(dialogid == 12345)
{
if(strlen(inputtext))
{
Encrypt(inputtext);
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, 50);
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), ACCOUNTS_FOLDER, playername3);
new ip[20];
GetPlayerIp(playerid,ip,sizeof(ip));
new File: hFile = fopen(string3, io_write);
if (hFile)
{
strmid(AccountInfo[playerid][aPassword], inputtext, 0, strlen(inputtext), 255);
new var[128];
format(var, 128, "Password=%s\n", AccountInfo[playerid][aPassword]);fwrite(hFile, var);
format(var, 128, "IP=%s\n",ip);fwrite(hFile, var);
fclose(hFile);
printf("%s is signed up.",playername3);
SendClientMessage(playerid, GREEN, "-|__ Voce^ se registrou. Pode Logar se Quiser agora. __|- ");
new girismsg[256];
format(girismsg,256,"Bem Vindo ao Brasil One Life\n\nUser Name: %s\n\nEntre com sua senha:",playername3);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
register[playerid] = 0;
login[playerid] = 1;
}
}
else if(!strlen(inputtext))
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new kayitmsg[256];
format(kayitmsg,256,"Bem Vindo ao Brasil One Life\n\n%s Voce^ na~o estб registrado\n\nDigite sua Senha:",name);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",kayitmsg,"Register","Quit");
register[playerid] = 1;
login[playerid] = 0;
}
}
if(dialogid == 12346)
{
Encrypt(inputtext);
new string2[128];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), ACCOUNTS_FOLDER, playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Password" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(AccountInfo[playerid][aPassword], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(AccountInfo[playerid][aPassword],inputtext, true ) == 0)
{
if(strlen(inputtext))
{
for(new p = 0; p < strlen(AccountInfo[playerid][aPassword]); p++)
{
inputtext[p] = '?';
}
SetTimerEx("LogIn", LOGIN_DELAY*1000, 0, "d", playerid);
printf("%s is logged in.",playername2);
new key[256] , val[256];
new Data[256];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
/*if(strcmp(key, "AdminLevel", true) == 0) // This is only an example if you want to add more stuff to store in a file.
{
val = ini_GetValue( Data );
AccountInfo[playerid][AdminLevel] = strval(val); // Uncommenting this will give you errors if the variable isn't defined.
}
*/
}
fclose(UserFile);
}
}
else
{
if(strlen(inputtext))
{
new girismsg[256];
printf("%s is used the wrong password.",playername2);
format(girismsg,256,"Senha Errada\n\nColoque a senha correta:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
if(!strlen(inputtext))
{
new girismsg[256];
printf("%s did not enter the password.",playername2);
format(girismsg,256,"Senha errada\n\nEntre com a senha correta:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
}
if(dialogid == 12347)
{
Encrypt(inputtext);
new string2[128];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), ACCOUNTS_FOLDER, playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Password" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(AccountInfo[playerid][aPassword], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(AccountInfo[playerid][aPassword],inputtext, true ) == 0)
{
if(strlen(inputtext))
{
for(new p = 0; p < strlen(AccountInfo[playerid][aPassword]); p++)
{
inputtext[p] = '?';
}
SetTimerEx("LogIn", LOGIN_DELAY*1000, 0, "d", playerid);
printf("%s is logged in.",playername2);
new key[256] , val[256];
new Data[256];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
/*if(strcmp(key, "AdminLevel", true) == 0) // This is only an example if you want to add more stuff to store in a file.
{
val = ini_GetValue( Data );
AccountInfo[playerid][AdminLevel] = strval(val); // Uncommenting this will give you errors if the variable isn't defined.
}
*/
}
fclose(UserFile);
}
}
else
{
if(strlen(inputtext))
{
new girismsg[256];
printf("%s is used the wrong password.",playername2);
format(girismsg,256,"Senha errada\n\nEntre com a senha correta:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
if(!strlen(inputtext))
{
new girismsg[256];
printf("%s did not enter the password.",playername2);
format(girismsg,256,"Senha errada\n\nEntre com a senha correta:");
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
}
}
else return Kick(playerid);
return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
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 OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
stock ini_GetKey( line[] )
{
new keyRes[256];
keyRes[0] = 0;
if ( strfind( line , "=" , true ) == -1 ) return keyRes;
strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
return keyRes;
}
stock ini_GetValue( line[] )
{
new valRes[256];
valRes[0]=0;
if ( strfind( line , "=" , true ) == -1 ) return valRes;
strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
return valRes;
}
public LogIn(playerid)
{
AccountInfo[playerid][aLogged] = 1;
register[playerid] = 0;
login[playerid] = 0;
return 1;
}
public OnPlayerUpdate(playerid)
{
if(IsPlayerConnected(playerid))
{
if(AccountInfo[playerid][aLogged] == 1)
{
new string3[128];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), ACCOUNTS_FOLDER, playername3);
new ip[20];
GetPlayerIp(playerid,ip,sizeof(ip));
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[128];
format(var, 128, "Password=%s\n", AccountInfo[playerid][aPassword]);fwrite(hFile, var);
format(var, 128, "IP=%s\n",ip);fwrite(hFile, var);
fclose(hFile);
}
}
}
return 1;
}
Encrypt(string[])
{
for(new x=0; x < strlen(string); x++)
{
string[x] += (3^x) * (x % 15);
if(string[x] > (0xff))
{
string[x] -= 256;
}
}
}