18.09.2015, 14:42
hi
when i try to register a new account it doesn't work need help
when i try to register a new account it doesn't work need help
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new LoginText[600],year,month,day,h,m,s,RegDate[40];
new file[255],str2[200],str[200];
new rrand =random(100);
new string[128];
if(dialogid == INTRO)
{
if(response)
{
format(LoginText,sizeof(LoginText),"{FFFFFF}Welcome %s\n\nPlease Register Your Account",GetName(playerid));
ShowPlayerDialog(playerid,RegisterPlayer,DIALOG_STYLE_INPUT,"Register",LoginText,"{00FF00}Register","{FF0000}Exit");
}
}
//REGISTER DIALOG
if(dialogid == RegisterPlayer)
{
if(!response)
{
format(str,200,"[SERVER] Player %s Has Been Kicked [Reason: Register Fail]",GetName(playerid));
Anounce(str);
LogTo("KickLog",str);
SetTimerEx("KickPlayer",1000,false,"d",playerid);
}
if(response)
{
if(fexist(file))
{
SendClientMessage(playerid,COLOR_ERROR,"This account already exists, please choose a different player name.");
return 1;
}
if(strlen(inputtext) < 4)
{
return ShowPlayerDialog(playerid,RegisterPlayer,DIALOG_STYLE_INPUT,"Register","{BF2A41}Your Password Must Be More Than 4 Caracters\n{BF2A41}Please Register Your Account \n","{00FF00}Register","{FF0000}Exit");
}
if(!fexist(file))
{
format(file,sizeof(file),AccFiles, GetName(playerid));
dini_Create(file);
getdate(year, month, day);
gettime(h,m,s);
format(RegDate, sizeof(RegDate), "%d/%d/%d [%dh:%d:%d]",day,month,year,h,m,s);
format(pInfo[playerid][IP], 500, PlayerIp(playerid));
dini_Set(file,"Name",GetName(playerid));
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_Set(file, "Ppass", inputtext);
dini_Set(file,"RegisterDate", RegDate);
dini_Set(file, "IP", pInfo[playerid][IP]);
dini_IntSet(file, "Banned", 0);
dini_IntSet(file, "Warnings", 0);
dini_IntSet(file, "Score", 0);
dini_IntSet(file, "Money", 2500);
dini_IntSet(file, "Bank", 5000);
dini_IntSet(file, "AdminLevel", 0);
dini_IntSet(file, "VipLevel", 0);
dini_IntSet(file, "RobSkill", 0);
dini_IntSet(file, "TerSkill", 0);
dini_IntSet(file, "RapeSkill", 0);
dini_IntSet(file, "WantedLevel", 0);
dini_IntSet(file, "Jail", 0);
dini_IntSet(file, "JailTime", 0);
dini_IntSet(file, "OwnCar", 0);
dini_IntSet(file, "Bomb", pInfo[playerid][Bomb]);
dini_IntSet(file, "Rank", 0);
dini_IntSet(file, "Gang-Z", 0);
dini_IntSet(file, "Muted", pInfo[playerid][Muted]);
dini_IntSet(file, "HasHit", pInfo[playerid][HasHit]);
dini_IntSet(file, "HitMoney", pInfo[playerid][HitMoney]);
dini_Set(file, "LastON", "NEVER");
pInfo[playerid][Registered] = 1;
format(LoginText,sizeof(LoginText),"[SERVER]{EA302E}You Are Now Registered %s.\n\n{452AC9}Please Login To Your Account",GetName(playerid));
SendClientMessage(playerid, SERVER_COLOR, LoginText);
ShowPlayerDialog(playerid, LoginPlayer, DIALOG_STYLE_PASSWORD, "LOGIN:", LoginText, "{00FF00}Login", "{FF0000}Exit");/**/
GameTextForPlayer(playerid, "~r~Registered!", 3000, 1);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
printf(" ");
printf("\nNew Account pNAME : %s // pPASS : %s // IP : %s\n",GetName(playerid),inputtext,pInfo[playerid][IP]);
printf(" ");
}
}
}
//LOGIN DIALOG
if(dialogid == LoginPlayer)
{
if(!response)
{
format(str2,200,"[SERVER] Player %s Has Been Kicked [Reason: Login Fail]",GetName(playerid));
Anounce(str2);
LogTo("KickLog",str2);
nosave[playerid] = 1;
SetTimerEx("KickPlayer",1000,false,"d",playerid);
}
if(strlen(inputtext) == 0)
return ShowPlayerDialog(playerid, LoginPlayer, DIALOG_STYLE_PASSWORD, "LOGIN:", "{FF0000}ERROR\n\n{452AC9}Please Enter Your Password To Login", "{00FF00}Login", "{FF0000}Exit");
format(file,sizeof(file),AccFiles, GetName(playerid));
if(udb_hash(inputtext) != dini_Int(file, "Password")) return ShowPlayerDialog(playerid, LoginPlayer, DIALOG_STYLE_PASSWORD, "LOGIN:", "{FF0000}ERROR\nInvalid Password\n{452AC9}Please Enter Your Password To Login", "{00FF00}Login", "{FF0000}Exit");
if(response)
{
pInfo[playerid][Registered] = 1;
pInfo[playerid][Spawned] = 0;
pInfo[playerid][Logged] = 1;
//DATA GET START
format(pInfo[playerid][IP], 500, PlayerIp(playerid));
dini_Set(file, "IP", pInfo[playerid][IP]);
pInfo[playerid][Banned] = dini_Int(file, "Banned");
pInfo[playerid][Warnings] = dini_Int(file, "Warnings");
pInfo[playerid][Score] = dini_Int(file, "Score");
pInfo[playerid][Money] = dini_Int(file, "Money");
pInfo[playerid][Bank] = dini_Int(file, "Bank");
pInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
pInfo[playerid][VipLevel] = dini_Int(file, "VipLevel");
pInfo[playerid][RobSkill] = dini_Int(file, "RobSkill");
pInfo[playerid][TerSkill] = dini_Int(file, "TerSkill");
pInfo[playerid][RapeSkill] = dini_Int(file, "RapeSkill");
pInfo[playerid][Wanted] = dini_Int(file, "WantedLevel");
pInfo[playerid][Jailed] = dini_Int(file, "Jail");
pInfo[playerid][JailTime] = dini_Int(file, "JailTime");
pInfo[playerid][OwnCar] = dini_Int(file, "OwnCar");
//bomb>>allready define
pInfo[playerid][Rank] = dini_Int(file, "Rank");
pInfo[playerid][GangZ] = dini_Int(file,"Gang-Z");
pInfo[playerid][Muted] = dini_Int(file, "Muted");
pInfo[playerid][LastON] = dini_Int(file, "LastON");
pInfo[playerid][HitMoney] = dini_Int(file, "HitMoney");
pInfo[playerid][HasHit] = dini_Int(file, "HasHit");
//DATA GET END
SetPlayerMoney(playerid,pInfo[playerid][Money]);
SetPlayerScore(playerid, pInfo[playerid][Score]);
SetPlayerWantedLevel(playerid, pInfo[playerid][Wanted]);
GameTextForPlayer(playerid, "~g~Logged In!", 3000, 1);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
}
return 1;
}