Login/Register System with dialog
#1

Hi guys. This time I am trying a login/register system, not only with a /login and /register command, but using dialogs. Now, I have these:

pawn Code:
public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, COLOR_BRIGHTRED, "Welcome to UK-DM");
    SendClientMessage(playerid, COLOR_BRIGHTRED, "Hope you enjoy!");
    SendClientMessage(playerid, COLOR_BRIGHTRED, "Type /commands for a list of commands");
    new name[MAX_PLAYER_NAME], file[128];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(file, sizeof(file), "\\Users\\$s.ini", name);
    if(!fexist(file)) {
        SendClientMessage(playerid, COLOR_YELLOW, "You are not registered, please register");
        ShowPlayerDialog(playerid, 100, DIALOG_STYLE_INPUT, "Please Register", "Enter Your Password Below", "Register", "Cancel");
    }
    else {
        new str[128];
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(str, sizeof(str), "Welcome Back ~r~%s. Enjoy!", name);
        SendClientMessage(playerid, COLOR_YELLOW, str);
        ShowPlayerDialog(playerid, 150, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new file[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(file, sizeof(file), "/Users/%s.ini", name);
    if(dini_Exists(file)) {
        dini_Create(file);
        dini_IntSet(file, "pw", PlayerInfo[playerid][pw]);
        dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
        dini_IntSet(file, "cash", PlayerInfo[playerid][cash]);
        dini_IntSet(file, "level", PlayerInfo[playerid][level]);
    }
    return 1;
}
What should I add to OnPlayerDialogResponse to get if the password is wrong or no. If it's wrong the server will kick him. Please help me !
Reply


Messages In This Thread
Login/Register System with dialog - by Rivera - 27.04.2011, 12:16
Re: Login/Register System with dialog - by Vickx - 27.04.2011, 12:20
Re: Login/Register System with dialog - by BASITJALIL - 27.04.2011, 12:25
Re: Login/Register System with dialog - by Rivera - 27.04.2011, 12:56

Forum Jump:


Users browsing this thread: 1 Guest(s)