"Server guide" after registration
#1

I'm writing a gamemode as we speak, and I came across the idea to make a server guide. It's common in roleplay server, but I don't know how it's done, therefore needing one's assistance. What do I need to do? I'll leave the code related to registration below.

pawn Код:
//OnPlayerConnect

else //If the connected user is not registered,
    {//then we will 'force' him to register :)
        ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
        return 1;
        }

//OnDialogResponse

        if(dialogid == dregister) //If dialog id is a register dialog
        {//then
            if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
            if(response) //if they clicked the first button "Register"
                {//then
                        if(!strlen(inputtext)) //If they didn't enter any password
                        {// then we will tell to them to enter the password to register
                                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;
                        }
                        //If they has entered a password for his account...
                        new hashpass[129]; //Now we will create a new variable to hash his/her password
                        WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to has their password
                        new INI:file = INI_Open(Path(playerid)); //will create a new variable to register their acount inside of Scriptfiles/Users folder
                        INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
                        INI_WriteString(file,"Password",hashpass);//This will write a hashed password in of user's account
                        INI_WriteInt(file,"Money",0);//Write an integer inside of user's account called "Money". We will set their money to 0 after he registered
                        INI_WriteInt(file,"Scores",0);//As explained above
                        INI_WriteInt(file,"Kills",0);//As explained above
                        INI_WriteInt(file,"Deaths",0);//As explained above
                        INI_Close(file);//Now after we've done saving their data, we now need to close the file
                        SendClientMessage(playerid,-1,"You have been successfully registered.");//Tell to them that they have successfully registered a new account
                        return 1;
                }
        }
Reply


Messages In This Thread
"Server guide" after registration - by Twizted - 16.02.2014, 11:16
Re: "Server guide" after registration - by Twizted - 17.02.2014, 13:07
Re: "Server guide" after registration - by Phil_Cutcliffe - 17.02.2014, 13:29
Re: "Server guide" after registration - by Twizted - 17.02.2014, 13:40
Re: "Server guide" after registration - by Phil_Cutcliffe - 17.02.2014, 14:46
Re: "Server guide" after registration - by iGetty - 17.02.2014, 14:48
Re: "Server guide" after registration - by Twizted - 18.02.2014, 12:55
Re: "Server guide" after registration - by Equuuuin0X - 18.02.2014, 13:25

Forum Jump:


Users browsing this thread: 1 Guest(s)