dialog based register/login
#1

OK so in my server it ask people to login/register in chat
but i want that when people join the server, it comes in dialog asking people to register.
Here is my /register /login cmd, and when player registers, he gets 3000$ into his account.

pawn Код:
new cmd[256], idx, tmp[256], name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "%s.czj", name);
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/register", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(strlen(tmp) == 0) return SendClientMessage(playerid, ERROR, "Use: /register [PASSWORD]");
        format(file,sizeof(file),"%s.czj", name);
        if(!fexist(file))
        {
            dini_Create(file);
            dini_IntSet(file, "Password", udb_hash(tmp));
            dini_IntSet(file, "Money", 2500);
            dini_IntSet(file, "Score", 1);
            dini_IntSet(file, "Bank", 1000);
            dini_IntSet(file, "RobSkill", 1);
            dini_IntSet(file, "TerSkill", 1);
            dini_IntSet(file, "Admin", 0);
            dini_IntSet(file, "Warnings", 0);
            dini_IntSet(file, "WantedLevel", 0);
            dini_IntSet(file, "Jail", 0);
            dini_IntSet(file, "RentalOwner", 0);
            dini_IntSet(file, "BarOwner", 0);
            dini_IntSet(file, "Drugs", 0);
            dini_IntSet(file, "C4", 0);
            SendClientMessage(playerid, GRAY, "Thanks for registering!");
            SendClientMessage(playerid, GRAY, "You may now login.");
            SendClientMessage(playerid, GRAY, "To do so, type: /login [PASSWORD]");
            GameTextForPlayer(playerid, "~r~Registered!", 3000, 1);
        }
        else SendClientMessage(playerid, ERROR, "This account is already registered in our system. Use: /login [PASSWORD]");
        return true;
    }

    if(strcmp(cmd, "/login", true) == 0)
    {
        new tmp2[256];
        tmp = strtok(cmdtext, idx);
        if(strlen(tmp) == 0) return SendClientMessage(playerid, ERROR, "Use: /login [PASSWORD]");
        else
        {
            if(IsPlayerLogged[playerid] == 1) return SendClientMessage(playerid, ERROR, "You are already logged in.");
            else
            {
                if(fexist(file))
                {
                    tmp2 = dini_Get(file, "Password");
                    if(udb_hash(tmp) != strval(tmp2)) return SendClientMessage(playerid, ERROR, "Wrong password.");
                    else
                    {
                        IsPlayerLogged[playerid] = 1;
                        SetPlayerMoney(playerid, dini_Int(file, "Money"));
                        SetPlayerScore(playerid, dini_Int(file, "Score"));
                        SetPlayerWantedLevel(playerid, dini_Int(file, "WantedLevel"));
                        SendClientMessage(playerid, GRAY, "You are now logged in. Your status will be saved on your logout.");
                        GameTextForPlayer(playerid, "~r~Logged In!", 3000, 1);
                    }
                }
                else return SendClientMessage(playerid, ERROR, "This username was not found on our database. Use: /register [PASSWORD]");
            }
        }
        return true;
    }
Please help.
Reply
#2

Help me please, anybody? ..
Reply
#3

This might help you do this:
https://sampforum.blast.hk/showthread.php?tid=273088
https://sampforum.blast.hk/showthread.php?tid=352703
https://sampforum.blast.hk/showthread.php?tid=270229
https://sampforum.blast.hk/showthread.php?tid=269361
https://sampforum.blast.hk/showthread.php?tid=267808
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)