19.02.2012, 09:59
Register Dialog:
Login Dialog:
i have this on player register & login but the problem is that when ever a player joins into my server and leaves without registering the account is saved on the next time if other player puts the same name instead of register dialog login dialog is appeared please help me fix that
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""Red"Registering...",""WHITE"You have entered an "Red"Invalid Password.\n"WHITE"Type your "Red"Password "WHITE"below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
GetPlayerName(playerid,PlayerInfo[playerid][pUsername],MAX_PLAYER_NAME);
INI_WriteString(File,"Username",PlayerInfo[playerid][pUsername]);
INI_WriteInt(File,"Password",udb_hash(inputtext));
................................
pawn Код:
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);