registration problem
#1

Hey I've got a problem with my registration system..

Basicaly it saves everything fine apart from money and it doesn't matter what password you use to login to any account it just lets you log in saying it was successfull lol? Not sure where this has gone wrong but please let me know what code you need to look at
Reply
#2

You need to show the part where it checks login and loads data.
Also show the part which saves the data.
Reply
#3

Hmmm here is what I think you need..

public OnPlayerConnect(playerid)
{
aDuty[playerid] = 0;
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s has joined the server. Welcome!",pName);
SendClientMessageToAll(0x33AA33AA,string);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(fexist(Path(playerid)))
{
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back to Los Santos Gang Wars. This account is registered. \nInsert your password to login to your account","Login","Quit");
}
else
{
ShowPlayerDialog(playerid,register,DIALOG_STYLE_IN PUT,"Register","Welcome! This account is not yet registered.\nEnter your own password to create a new account.","Register","Quit");
return 1;
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
aDuty[playerid] = 0;
new
string[64],
name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
switch(reason)
{
case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
}
SendClientMessageToAll(0x33AA33AA,string);
if(fexist(Path(playerid)))
{
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteInt(file,"Adminlevel",pInfo[playerid][Adminlevel]);
INI_WriteInt(file,"Money",GetPlayerMoney(playerid) );
INI_WriteInt(file,"Scores",GetPlayerScore(playerid ));
INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
INI_WriteInt(file,"Banned",pInfo[playerid][Banned]);
INI_WriteInt(file,"Hours",pInfo[playerid][pPlayingTime]);
INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
INI_Close(file);
return 1;
}
return 1;
}
Reply
#4

This is also under.... public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

if(dialogid == register)
{
if(!response) return Kick(playerid);
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,register,DIALOG_STYLE_IN PUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"Adminlevel",0);
INI_WriteInt(file,"Money",0);
INI_WriteInt(file,"Scores",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Banned",0);
INI_WriteInt(file,"pPlayingTime",0);
INI_WriteInt(file,"Deaths",0);
INI_Close(file);
SendClientMessage(playerid,-1,"You have been successfully registered");
return 1;
}
}
if(dialogid == login)
{
if(!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{
INI_ParseFile(Path(playerid),"loadaccount_%s",.bEx tra = true, .extra = playerid);
SetPlayerScore(playerid,pInfo[playerid][Scores]);
GivePlayerMoney(playerid,pInfo[playerid][Money]);
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
}
else
{
ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
return 1;
}
}
}
Reply
#5

pawn Код:
if(dialogid == register)
{
if(!response) return Kick(playerid);
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,register,DIALOG_STYLE_IN PUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"Adminlevel",0);
INI_WriteInt(file,"Money",0);
INI_WriteInt(file,"Scores",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Banned",0);
INI_WriteInt(file,"pPlayingTime",0);
INI_WriteInt(file,"Deaths",0);
INI_Close(file);
SendClientMessage(playerid,-1,"You have been successfully registered");
return 1;
}
}
if(dialogid == login)
{
if(!response) return Kick(playerid);
if(response)
{
INI_ParseFile(Path(playerid),"loadaccount_%s",.bEx tra = true, .extra = playerid);
new INI:file = INI_Open(Path(playerid));
new hashpass[129];
INT_GetString(file, "Password", pInfo[playerid][Pass]);
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{
INI_GetInt(file, "Score", pInfo[playerid][Scores]);
INI_GetInt(file, "Money", pInfo[playerid][Money]);
SetPlayerScore(playerid,pInfo[playerid][Scores]);
GivePlayerMoney(playerid,pInfo[playerid][Money]);
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
INI_Close(file);
}
else
{
ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
return 1;
}
}
}
I'm not sure if GetString and GetInt are the correct functions, but Im sure you can work it out.
Reply
#6

Brain freeze :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)