05.02.2015, 01:50
you either have this function because I see you have it in OnPlayerConnect and goes OnDialogResponse
pawn Код:
if(dialogid == dregister)
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"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,"User");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"AdminLevel",0);
INI_WriteInt(file,"VIPLevel",0);
INI_WriteInt(file,"Money",0);
INI_WriteInt(file,"Scores",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Deaths",0);
INI_WriteInt(file,"Color",COLOR_WHITE);
INI_WriteInt(file,"Skin",162);
INI_WriteInt(file,"GodEnabled",0);
INI_WriteInt(file,"isAFK",0);
INI_WriteInt(file,"Muted",0);
INI_WriteInt(file,"GodEnabled",0);
INI_WriteInt(file,"isAFK",0);
INI_WriteInt(file,"Muted",0);
INI_WriteInt(file,"CustomSlot0",0);
INI_WriteInt(file,"CustomSlot0a",0);
INI_WriteInt(file,"CustomSlot1",0);
INI_WriteInt(file,"CustomSlot1a",0);
INI_WriteInt(file,"CustomSlot2",0);
INI_WriteInt(file,"CustomSlot2a",0);
INI_WriteInt(file,"CustomSlot3",0);
INI_WriteInt(file,"CustomSlot3a",0);
INI_WriteInt(file,"CustomSlot4",0);
INI_WriteInt(file,"CustomSlot4a",0);
INI_WriteInt(file,"CustomSlot5",0);
INI_WriteInt(file,"CustomSlot5a",0);
INI_WriteInt(file,"CustomSlot6",0);
INI_WriteInt(file,"CustomSlot6a",0);
INI_WriteInt(file,"CustomSlot7",0);
INI_WriteInt(file,"CustomSlot7a",0);
INI_WriteInt(file,"CustomSlot8",0);
INI_WriteInt(file,"CustomSlot8a",0);
INI_WriteInt(file,"CustomSlot9",0);
INI_WriteInt(file,"CustomSlot9a",0);
INI_WriteInt(file,"CustomSlot10",0);
INI_WriteInt(file,"CustomSlot10a",0);
INI_WriteInt(file,"CustomSlot11",0);
INI_WriteInt(file,"CustomSlot11a",0);
INI_WriteFloat(file,"POS_X",2506.0935);
INI_WriteFloat(file,"POS_Y",-1672.0536);
INI_WriteFloat(file,"POS_Z",13.3714);
INI_Close(file);
return 1;
}
}
if(dialogid == dlogin)
{
if(!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass, pInfo[playerid][Pass], false))
{
INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
pInfo[playerid][Logged] = 1;
GivePlayerMoney(playerid, pInfo[playerid][Money]);
SetPlayerPos(playerid, pInfo[playerid][POS_X], pInfo[playerid][POS_Y], pInfo[playerid][POS_Z]);
SetPlayerSkin(playerid, pInfo[playerid][Skin]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot0], pInfo[playerid][CustomSlot0a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot1], pInfo[playerid][CustomSlot1a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot2], pInfo[playerid][CustomSlot2a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot3], pInfo[playerid][CustomSlot3a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot4], pInfo[playerid][CustomSlot4a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot5], pInfo[playerid][CustomSlot5a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot6], pInfo[playerid][CustomSlot6a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot7], pInfo[playerid][CustomSlot7a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot8], pInfo[playerid][CustomSlot8a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot9], pInfo[playerid][CustomSlot9a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot10], pInfo[playerid][CustomSlot10a]);
GivePlayerWeapon(playerid, pInfo[playerid][CustomSlot11], pInfo[playerid][CustomSlot11a]);
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
print("User logged in.");
}
else
{
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
}
return 1;
}
}
return 1;
}