PDA

View Full Version : HELP for Login


kloning1
17/03/2014, 03:11 PM
hi, i have problem with login system
because the user was not about to unload
I was wondering, why not return the money and score, only admin and passwords are loaded

if(dialogid == 1) //Register
{
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Register","Kamu Tidak Login/ Akun ada tidak tersedia\nsilahkan masukan password anda","Register","Quit");
}
else
{
new file[128], name[128];
GetPlayerName(playerid,name,128);
format(file,128,"User/%s.txt",name);
dini_Create(file);
dini_IntSet(file,"Password",udb_hash(inputtext));
dini_IntSet(file, "Admin", false);
Logged[playerid] = true;
SendClientMessage(playerid, White,"Registration Succes,all command /help");
}
}
else if(!response)
{
Kick(playerid);
}
#pragma tabsize 0
return 1;
}

if(dialogid == 2) // Loggin
{
if(response)
{
new file[128], name[128], pass[256];
GetPlayerName(playerid, name, 128);
format(file,128,"User/%s.txt",name);
pass = dini_Get(file,"Password");
if(udb_hash(inputtext) != strval(pass))
{
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"LOGIN","Kamu Salah Memasukkan Password\nSilahkan masukkan kembali","login","leave");
}
else
{
if(dini_Int(file,"Admin") == 0){pInfo[playerid][Admin]=false;}
if(dini_Int(file,"Admin") == 1){pInfo[playerid][Admin]=true;}
if(dini_Int(file,"Admin") == 2){pInfo[playerid][Admin]=false;}
Logged[playerid] = true;
SendClientMessage(playerid, White,"Succesful Logged");
}
}
else if(!response)
{
Kick(playerid);
}
return 1;
}
return 1;
}

iThePunisher
17/03/2014, 04:18 PM
because you are just saving admin level and the password
you are not saving player money and scores

kloning1
17/03/2014, 04:39 PM
because you are just saving admin level and the password
you are not saving player money and scores

but, i add'd
and no effect~

public OnPlayerDisconnect(playerid, reason)
{
gNameTags[playerid] = 0;
new name[MAX_PLAYER_NAME], string[128], pFile[128];
GetPlayerName(playerid, name, sizeof(name));
switch(reason)
{
case 0: format(string, sizeof(string), "Server : Player %s logged out. (Lost Connection)", name);
case 1: format(string, sizeof(string), "Server : Player %s logged out from server. ", name);
case 2: format(string, sizeof(string), "Server : Player %s logged out. (Kicked/Banned)", name);
}
SendClientMessageToAll(ERROR, string);
GetPlayerName(playerid, name, sizeof(name));
format(pFile, sizeof(pFile), "User/%s.txt", name);
dini_IntSet(pFile, "Money", GetPlayerMoney(playerid));
dini_IntSet(pFile, "Score", GetPlayerScore(playerid));
dini_IntSet(pFile, "Death", pInfo[playerid][Death]);
dini_IntSet(pFile, "Kills", pInfo[playerid][Kills]);
return 1;
}

can you give me tutorial :3
#newbie

kloning1
18/03/2014, 12:22 AM
helppp pleaseee :3

VishvaJeet
18/03/2014, 03:52 AM
Use when player login:

GivePlayerMoney(playerid, dini_Int(pFile, "Money");
SetPlayerScore(playerid, dini_Int(pFile, "Score");
pInfo[playerid][Kills] = dini_Int(pFile, "kills");
pInfo[playerid][Death] = dini_Int(pFile, "Death");

kloning1
18/03/2014, 09:35 AM
Use when player login:

GivePlayerMoney(playerid, dini_Int(pFile, "Money");
SetPlayerScore(playerid, dini_Int(pFile, "Score");
pInfo[playerid][Kills] = dini_Int(pFile, "kills");
pInfo[playerid][Death] = dini_Int(pFile, "Death");

nice ~ thanks man ~