Код HTML:
/*==============================================================================
OnPlayerRegister
==============================================================================*/
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new stringregister[128];
new playernameregister[MAX_PLAYER_NAME];
GetPlayerName(playerid, playernameregister, sizeof(playernameregister));
format(stringregister, sizeof(stringregister), "Accounts/%s.ini", playernameregister);
new File: hFile = fopen(stringregister, io_write);
if (hFile)
{
strmid(PlayerInfo[playerid][pPassword], password, 0, strlen(password), 255);
new var[32];
format(var, 32, "Password = %s\r\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
format(var, 32, "Level = %d\r\n", PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 32, "Sex = %d\r\n", PlayerInfo[playerid][pSex]);fwrite(hFile, var);
format(var, 32, "Oras = %d\r\n", PlayerInfo[playerid][pOras]);fwrite(hFile, var);
format(var, 32, "Varsta = %d ani\r\n", PlayerInfo[playerid][pVarsta]);fwrite(hFile, var);
format(var, 32, "Admin Level = %d\r\n", PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
format(var, 32, "Helper Level = %d\r\n", PlayerInfo[playerid][pHelper]);fwrite(hFile, var);
format(var, 32, "Leader Faction = %d\r\n", PlayerInfo[playerid][pLeader]);fwrite(hFile, var);
format(var, 32, "Member Faction = %d\r\n", PlayerInfo[playerid][pMember]);fwrite(hFile, var);
format(var, 32, "Bani in banca= %d\r\n", PlayerInfo[playerid][pBankMoney]);fwrite(hFile, var);
format(var, 32, "Bani in mana= %d\r\n", PlayerInfo[playerid][pMoney]);fwrite(hFile, var);
format(var, 32, "Stare inregistrare = %d\r\n", PlayerInfo[playerid][pRegister]);fwrite(hFile, var);
format(var, 32, "Stare tutorial = %d\r\n", PlayerInfo[playerid][pTutorial]);fwrite(hFile, var);
format(var, 32, "Adjustable=%d\r\n",PlayerInfo[playerid][pAdjustable]);fwrite(hFile, var);
format(var, 32, "Login An = %d\r\n", PlayerInfo[playerid][pLoginAn]);fwrite(hFile, var);
format(var, 32, "Login Luna = %d\r\n", PlayerInfo[playerid][pLoginLuna]);fwrite(hFile, var);
format(var, 32, "Login Zi = %d\r\n", PlayerInfo[playerid][pLoginZi]);fwrite(hFile, var);
format(var, 32, "Login Ora = %d\r\n", PlayerInfo[playerid][pLoginOra]);fwrite(hFile, var);
format(var, 32, "Login Minute = %d\r\n", PlayerInfo[playerid][pLoginMinute]);fwrite(hFile, var);
format(var, 32, "Login Secunde = %d\r\n", PlayerInfo[playerid][pLoginSecunde]);fwrite(hFile, var);
fclose(hFile);
if(gPlayerLogTries[playerid] == 0)
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid, loginname, sizeof(loginname));
format(loginstring, sizeof(loginstring), "{FFFFFF}Bun venit inapoi!, {00FF40}%s{FFFFFF},\nAcest cont este inregistrat.\nScrieti {F3FF02}parola:",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", loginstring, "Login", "Quit");
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid, loginname, sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FFFFFF}Ai introdus o {F81414}parola gresita.{FFFFFF}\nTe rugam introdu {F81414}parola{FFFFFF} corecta a aici:",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", loginstring, "Login", "Quit");
return 1;
}
}
}
return 1;
}
/*==============================================================================
OnPlayerLogout
==============================================================================*/
public OnPlayerLogout(playerid)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
new stringregister[32];
new playernameregister[MAX_PLAYER_NAME];
GetPlayerName(playerid, playernameregister, sizeof(playernameregister));
format(stringregister, sizeof(stringregister), "Accounts/%s.ini", playernameregister);
new File: hFile = fopen(stringregister, io_write);
if (hFile)
{
new var[32];
format(var, 32, "Password = %s\r\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
format(var, 32, "Level = %d\r\n", PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
format(var, 32, "Sex = %d\r\n", PlayerInfo[playerid][pSex]);fwrite(hFile, var);
format(var, 32, "Oras = %d\r\n", PlayerInfo[playerid][pOras]);fwrite(hFile, var);
format(var, 32, "Varsta = %d ani\r\n", PlayerInfo[playerid][pVarsta]);fwrite(hFile, var);
format(var, 32, "Admin Level = %d\r\n", PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
format(var, 32, "Helper Level = %d\r\n", PlayerInfo[playerid][pHelper]);fwrite(hFile, var);
format(var, 32, "Leader Faction = %d\r\n", PlayerInfo[playerid][pLeader]);fwrite(hFile, var);
format(var, 32, "Member Faction = %d\r\n", PlayerInfo[playerid][pMember]);fwrite(hFile, var);
format(var, 32, "Bani in banca = %d\r\n", PlayerInfo[playerid][pBankMoney]);fwrite(hFile, var);
format(var, 32, "Bani in mana = %d\r\n", PlayerInfo[playerid][pMoney]);fwrite(hFile, var);
format(var, 32, "Stare inregistrare = %d\r\n", PlayerInfo[playerid][pRegister]);fwrite(hFile, var);
format(var, 32, "Stare tutorial = %d\r\n", PlayerInfo[playerid][pTutorial]);fwrite(hFile, var);
format(var, 32, "Adjustable = %d\r\n",PlayerInfo[playerid][pAdjustable]);fwrite(hFile, var);
format(var, 32, "Login An = %d\r\n", PlayerInfo[playerid][pLoginAn]);fwrite(hFile, var);
format(var, 32, "Login Luna = %d\r\n", PlayerInfo[playerid][pLoginLuna]);fwrite(hFile, var);
format(var, 32, "Login Zi = %d\r\n", PlayerInfo[playerid][pLoginZi]);fwrite(hFile, var);
format(var, 32, "Login Ora = %d\r\n", PlayerInfo[playerid][pLoginOra]);fwrite(hFile, var);
format(var, 32, "Login Minute = %d\r\n", PlayerInfo[playerid][pLoginMinute]);fwrite(hFile, var);
format(var, 32, "Login Secunde = %d\r\n", PlayerInfo[playerid][pLoginSecunde]);fwrite(hFile, var);
fclose(hFile);
}
}
}
return 1;
}
/*==============================================================================
OnPlayerLogin
==============================================================================*/
public OnPlayerLogin(playerid,password[])
{
new stringlogin[64];
new playernamelogin[MAX_PLAYER_NAME];
GetPlayerName(playerid, playernamelogin, sizeof(playernamelogin));
format(stringlogin, sizeof(stringlogin), "Accounts/%s.ini", playernamelogin);
new File: UserFile = fopen(stringlogin, io_read);
if (UserFile)
{
new PassData[256];
new keytmp[256], valtmp[256];
fread(UserFile, PassData, sizeof(PassData));
keytmp = ini_GetKey(PassData);
if(strcmp(keytmp, "Key", true) == 0)
{
valtmp = ini_GetValue(PassData);
strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][pPassword],password, true ) == 0)
{
new key[256], val[256];
new Data[256];
while(fread(UserFile, Data, sizeof(Data)))
{
key = ini_GetKey(Data);
if(strcmp(key, "Level", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pLevel] = strval(val); }
if(strcmp(key, "Sex", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pSex] = strval(val); }
if(strcmp(key, "Oras", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pOras] = strval(val); }
if(strcmp(key, "Varsta", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pVarsta] = strval(val); }
if(strcmp(key, "Admin Level", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pAdmin] = strval(val); }
if(strcmp(key, "Helper Level", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pHelper] = strval(val); }
if(strcmp(key, "Leader Faction", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pLeader] = strval(val); }
if(strcmp(key, "Member Faction", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pMember] = strval(val); }
if(strcmp(key, "Bani in banca", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pBankMoney] = strval(val); }
if(strcmp(key, "Bani in mana", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pMoney] = strval(val); }
if(strcmp(key, "Stare inregistrare", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pRegister] = strval(val); }
if(strcmp(key, "Stare tutorial", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pTutorial] = strval(val); }
if(strcmp(key, "Adjustable", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pAdjustable] = strval(val); }
if(strcmp(key, "Login An", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pLoginAn] = strval(val); }
if(strcmp(key, "Login Luna", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pLoginLuna] = strval(val); }
if(strcmp(key, "Login Zi", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pLoginZi] = strval(val); }
if(strcmp(key, "Login Ora", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pLoginOra] = strval(val); }
if(strcmp(key, "Login Minute", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pLoginMinute] = strval(val); }
if(strcmp(key, "Login Secunde", true) == 0) {val = ini_GetValue(Data); PlayerInfo[playerid][pLoginSecunde] = strval(val); }
}
fclose(UserFile);
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid, loginname, sizeof(loginname));
format(loginstring, sizeof(loginstring), "{FFFFFF}Ai introdus o {F81414}parola gresita.{FFFFFF}\nTe rugam introdu {F81414}parola{FFFFFF} corecta a aici:",loginname);
ShowPlayerDialog(playerid,1, DIALOG_STYLE_PASSWORD, "Login", loginstring, "Login", "Quit");
gPlayerLogTries[playerid] += 1;
return 1;
}
PlayerInfo[playerid][pAdjustable] = 0;
ResetPlayerMoney(playerid);
ConsumingMoney[playerid] = 1;
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
CurrentMoney[playerid] = PlayerInfo[playerid][pMoney];
if(PlayerInfo[playerid][pRegister] == 0)
{
PlayerInfo[playerid][pRegister] = 1;
PlayerInfo[playerid][pLevel] = 1;
PlayerInfo[playerid][pBankMoney] = 5000;
ShowPlayerDialog(playerid,3, DIALOG_STYLE_LIST, "Care este sex-ul tau?","Masculin \nFeminin","Select","");
GivePlayerMoney(playerid, 1250);
}
SetPlayerSpawn(playerid);
format(stringlogin, sizeof(stringlogin), ""ALB"SERVER: Bun venit %s",playernamelogin);
SendClientMessage(playerid, -1,stringlogin);
gPlayerLogged[playerid] = 1;
new an, luna, zi, ora, minute, secunde;
getdate(an, luna, zi);
gettime(ora, minute, secunde);
PlayerInfo[playerid][pLoginAn] = an;
PlayerInfo[playerid][pLoginLuna] = luna;
PlayerInfo[playerid][pLoginZi] = zi;
PlayerInfo[playerid][pLoginOra] = ora;
PlayerInfo[playerid][pLoginMinute] = minute;
PlayerInfo[playerid][pLoginSecunde] = secunde;
}
return 1;
}
/*==============================================================================
OnPlayerRequestClass
==============================================================================*/
public OnPlayerRequestClass(playerid, classid)
{
new stringlogin[64];
new playernamelogin[MAX_PLAYER_NAME];
if(RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
{
if(gPlayerAccount[playerid] != 0)
{
if(gPlayerLogTries[playerid] == 0)
{
GetPlayerName(playerid, playernamelogin, sizeof(playernamelogin));
format(stringlogin, sizeof(stringlogin), "Accounts/%s.ini", playernamelogin);
new File: UserFile = fopen(stringlogin, io_read);
if (UserFile)
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while (fread(UserFile, Data, sizeof(Data)))
{
key = ini_GetKey(Data);
if( strcmp( key , "Login An" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoginAn] = strval( val ); }
if( strcmp( key , "Login Luna" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoginLuna] = strval( val ); }
if( strcmp( key , "Login Zi" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoginZi] = strval( val ); }
if( strcmp( key , "Login Ora" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoginOra] = strval( val ); }
if( strcmp( key , "Login Minute" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoginMinute] = strval( val ); }
if( strcmp( key , "Login Secunde" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoginSecunde] = strval( val ); }
}
}
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FFFFFF}Salut {00FF40}%s{FFFFFF},Bine ai venit pe Cs-Area Role Play! Ultima ta logare a fost in: {FFFF00}%02d/%02d/%04d %02d:%02d:%02d\n\n{FFFFFF}Parola:",loginname,PlayerInfo[playerid][pLoginZi],PlayerInfo[playerid][pLoginLuna],PlayerInfo[playerid][pLoginAn],PlayerInfo[playerid][pLoginOra],PlayerInfo[playerid][pLoginMinute],PlayerInfo[playerid][pLoginSecunde]);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD,"Logare server",loginstring,"Login","");
fclose(UserFile);
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FFFFFF}Ai introdus o {F81414}parola gresita.{FFFFFF}\nTe rugam introdu {F81414}parola{FFFFFF} corecta a aici:",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD,"Logare server",loginstring, "Login", "Quit");
}
}
else
{
gPlayerAccount[playerid] = 0;
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"{FFFFFF}Bun venit {FF0000}%s{FFFFFF},\nAcest cont nu a fost detectat in baza de date.\nVa rugam sa scrieti parola:",regname);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, "Register", regstring, "Register", "Quit");
}
}
return 1;
}
/*==============================================================================
OnPlayerConnect
==============================================================================*/
public OnPlayerConnect(playerid)
{
CurrentMoney[playerid] = 0;
ConsumingMoney[playerid] = 0;
KickPlayer[playerid] = 0;
gPlayerLogged[playerid] = 0;
gPlayerLogTries[playerid] = 0;
RegistrationStep[playerid] = 0;
TutorialTime[playerid] = 0;
GivePlayerMoney(playerid,PlayerInfo[playerid][pMoney]);
PlayerInfo[playerid][pLevel] = 0;
PlayerInfo[playerid][pSex] = 0;
PlayerInfo[playerid][pOras] = 0;
PlayerInfo[playerid][pVarsta] = 0;
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pHelper] = 0;
PlayerInfo[playerid][pLeader] = 0;
PlayerInfo[playerid][pMember] = 0;
PlayerInfo[playerid][pBankMoney] = 0;
PlayerInfo[playerid][pMoney] = 0;
PlayerInfo[playerid][pRegister] = 0;
PlayerInfo[playerid][pTutorial] = 0;
PlayerInfo[playerid][pAdjustable] = 0;
PlayerInfo[playerid][pLoginAn] = 0;
PlayerInfo[playerid][pLoginLuna] = 0;
PlayerInfo[playerid][pLoginZi] = 0;
PlayerInfo[playerid][pLoginOra] = 0;
PlayerInfo[playerid][pLoginMinute] = 0;
PlayerInfo[playerid][pLoginSecunde] = 0;
new stringlogin[64];
new playernamelogin[MAX_PLAYER_NAME];
GetPlayerName(playerid, playernamelogin, sizeof(playernamelogin));
format(stringlogin, sizeof(stringlogin), "Accounts/%s.ini", playernamelogin);
new File: UserFile = fopen(stringlogin, io_read);
if (UserFile)
{
gPlayerAccount[playerid] = 1;
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, ""GRI2"Acest cont a fost detectat in baza de date!");
SendClientMessage(playerid, -1, ""GRI2"Va rugam sa scrieti parola pentru a va loga, multumim.");
return 1;
}
else
{
gPlayerAccount[playerid] = 0;
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, "");
SendClientMessage(playerid, -1, ""GRI2"Daca vreti sa fiti in aceasta comunitate, trebuie sa respectati regurile.");
SendClientMessage(playerid, -1, ""GRI2"Please enter your password in the box below and follow the steps for creating your account.");
SendClientMessage(playerid, -1, ""VERDE3"Respecta si vei fi respectat!!");
return 1;
}
}
/*================================================= =============================
================================================== ============================*/
Код HTML:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new sendername[MAX_PLAYER_NAME];
new string[128];
if(dialogid == 3) // Dialog inregistrare "Care este sex-ul tau ?"
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid,-1,"Bun, deci esti baiat.");
ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"In care oras vrei sa locuiesti?","Los Santos \nSan Fierro","Select","");
}
else if(listitem == 1)
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid,-1,"Bun, deci esti fata.");
ShowPlayerDialog(playerid,4,DIALOG_STYLE_LIST,"In care oras vrei sa locuiesti?","Los Santos \nSan Fierro","Select","");
}
}
}
if(dialogid == 4) // Dialog inregistrare "In care oras vrei sa locuiesti?"
{
if(response)
{
if(listitem == 0)
{
PlayerInfo[playerid][pOras] = 1; // Los Santos
SendClientMessage(playerid,-1,"Ok, deci vrei sa locuiesti in Los Santos.");
ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Varsta","Cati ani ai? [10-80]","OK","");
}
else if(listitem == 1)
{
PlayerInfo[playerid][pOras] = 2; // San Fierro
SendClientMessage(playerid,-1,"Ok, deci vrei sa locuiesti in San Fierro");
ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Varsta","Cati ani ai? [10-80]","OK","");
}
}
}
if(dialogid == 5)
{
if(response)
{
new varsta = strval(inputtext);
if(varsta >9 && varsta<81)
{
format(string,256,"Ok, deci ai %d ani !",varsta);
SendClientMessage(playerid,-1,string);
PlayerInfo[playerid][pVarsta] = varsta;
RegistrationStep[playerid] = 0;
TutorialTime[playerid] = 1;
}
else return ShowPlayerDialog(playerid,5,DIALOG_STYLE_INPUT,"Varsta","Cati ani ai? [10-80]","OK","");
}
}
if(response)
{
if(dialogid == 1)
{
if(strlen(inputtext))
{
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
OnPlayerLogin(playerid, tmppass);
}
else
{
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"{FFFFFF}Aceasta parola nu este {F81414}parola corecta.{FFFFFF}\nVa rugam sa introduceti {F81414}parola corecta{FFFFFF} de la accest cont:",loginname);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT,"Login", loginstring,"Login","Quit");
return 1;
}
}
if(dialogid == 2)
{
if(strlen(inputtext))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Accounts/%s.ini", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, -1, ""ROSU"Acest nume este deja luat!Va rugam sa alegeti altu.");
fclose(hFile);
return 1;
}
new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
OnPlayerRegister(playerid,tmppass);
}
else
{
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"{FFFFFF}Bun venit {FF0000}%s{FFFFFF},\nAcest cont nu a fost detectat in baza de date.\nVa rugam sa scrieti. {F3FF02}parola de la{FFFFFF} noul cont:",regname);
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Register",regstring,"Register","Quit");
return 1;
}
}
return 1;
}
else if(!response)
{
if(dialogid == 1 || dialogid == 2)
{
Kick(playerid);
}
}
return 1;
}