if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "You are registered. Input your password below", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, 0xFFFFFFFF, "Wrong passord. Please re-enter");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "You are registered. Input your password below", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,0xFFFFFFFF, "You have successfully logged in!");
}
return 1;
}
///LOGIN-REGISTER///
enum pInfo
{
pAdminLevel,
pCash,
pScore,
pGang,
pGangLeader,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "Accounts/%s.ini"
public OnPlayerConnect(playerid)
{
//LOGIN-REGISTER
TogglePlayerSpectating(playerid, true);
gPlayerLogged[playerid] = 0;
new name[MAX_PLAYER_NAME], file[256], string[128], lgin[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (!dini_Exists(file))
{
format(string, 128, "Dobro došli na Populous RP server %s \nVaš account nije registriran na ovom serveru, molimo da se registrirate", name);
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Registracija", string, "Registriraj se", "Odustani");
}
if(fexist(file))
{
format(lgin, 128, "Dobro došli %s \nUnesite svoju lozinku: ", name);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", lgin, "Login", "Odusani");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
//LOGIN-REGISTER
if (dialogid == 0)
{
if(response == 0)
{
Kick(playerid);
}
if(response == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (strlen(inputtext) < 5) return SendClientMessage(playerid,0xEF994300,"Lozinka nije dovoljno dugačka") && format(string, 128, "%s \nMolimo unesite svoju lozinku: \nNAPOMENA: Lozinka mora sadržavati najmanje 5 znakova i najvše 20 znakova!", name) && ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Registracija", string, "Registriraj se", "Odustani");
if (strlen(inputtext) > 20) return SendClientMessage(playerid,0xEF994300,"Lozinka je predugačka") && format(string, 128, "%s \nMolimo unesite svoju lozinku: \nNAPOMENA: Lozinka mora sadržavati najmanje 5 znakova i najvše 20 znakova!", name) && ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Registracija", string, "Registriraj se", "Odustani");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Gang",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "GangLeader",PlayerInfo[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
format(string, 128, "Čestitamo! Uspješno ste registrirani! \nIme: %s \nLozinka: %s \nKako bi potvrdili svoju registraciju molimo da se ulogirate:", name, inputtext);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Registracija", string, "Login", "Odusani");
}
}
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], file[256], tmp, string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
SendClientMessage(playerid, 0xEF994300, "Kriva lozinka!");
format(string, 128, "Dobro došli %s \nUnesite svoju lozinku: ", name);
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", string, "Login", "Odusani");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][pGang] = dini_Int(file, "Gang");
PlayerInfo[playerid][pGangLeader] = dini_Int(file, "GangLeader");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SetSpawnInfo(playerid, 0, 101, 2226.9934,-1160.0302,25.7671,88.9158,0,0,0,0,0,0);
TogglePlayerSpectating(playerid, false);
}
}
if(response == 0)
{
Kick(playerid);
}
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256], tmp, string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp)
{
SendClientMessage(playerid, 0xEF994300, "Kriva lozinka!");
format(string, 128, "%s \nKako bi potvrdili svoju registraciju molimo da se ulogirate:", name);
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Registracija", string, "Login", "Odusani");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][pGang] = dini_Int(file, "Gang");
PlayerInfo[playerid][pGangLeader] = dini_Int(file, "GangLeader");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SetSpawnInfo(playerid, 0, 101, 2226.9934,-1160.0302,25.7671,88.9158,0,0,0,0,0,0);
TogglePlayerSpectating(playerid, false);
}
if(response == 0)
{
Kick(playerid);
}
}
if(dialogid == 3)
{
if(response == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
format(string, 128, "%s \nMolimo unesite svoju lozinku: \nNAPOMENA: Lozinka mora sadržavati najmanje 5 znakova i najvše 20 znakova!", name);
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Registracija", string, "Registriraj se", "Odustani");
}
else
{
Kick(playerid);
}
}
///////////////////////////////////-----END----//////////////////////////////////////
return 1;
}
you are not using string[128]; so delete
put #pragma tabsize 0 at top under include sa-mp for not implemented idk becouse i dont see |
yeah bad use pragma for beginner you have 2 learn how to use TAB xD
but i dont use pragma |