"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
#2

Could anybody help me?
Reply
#3

Here you go. Just change the camera positions by going into MTA Map Editor. Go to a position with your game camera where you want the camera to be and dump the position as a bookmark. Then just look from that position at what you want the camera to look at and go towards it a bit and then stop and book mark it. First coordinates are the camera position second are the camera look at coordinates. Then the rest is self explanatory.

pawn Код:
//OnPlayerConnect
new Tutorial_Timer[MAX_PLAYERS];
new Tutorial[MAX_PLAYERS];

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
                        Tutorial_Timer[playerid] = SetTimerEx("Cam1", 2000, false, "i", playerid); // Put them into the Tutorial
                        return 1;
                }
        }
}

forward Cam1(playerid);
public Cam1(playerid)
{
    Tutorial[playerid] = 1;
    TogglePlayerSpectating(playerid, 1);
    Tutorial_Timer[playerid] = SetTimerEx("CamPos1", 1000, false, "i", playerid);
}

forward CamPos1(playerid);
public CamPos1(playerid)
{
    SetPlayerCameraPos(playerid, -2018.9770507813,93.15909576416,56.630706787109);
    SetPlayerCameraLookAt(playerid, -1984.8200683594,124.32752227783,27.408241271973);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos2", 25000, false, "i", playerid);
}

forward CamPos2(playerid);
public CamPos2(playerid)
{
    SetPlayerCameraPos(playerid, -2038.7691650391,-85.648880004883,42.076145172119);
    SetPlayerCameraLookAt(playerid, -2030.4619140625,-97.781234741211,35.277099609375);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos3", 25000, false, "i", playerid);
}

forward CamPos3(playerid);
public CamPos3(playerid)
{
    SetPlayerCameraPos(playerid, 1349.7008056641,-1287.9132080078,22.348476409912);
    SetPlayerCameraLookAt(playerid, 1367.6077880859,-1280.2287597656,15.368454933167);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos4", 25000, false, "i", playerid);
}

forward CamPos4(playerid);
public CamPos4(playerid)
{
    SetPlayerCameraPos(playerid, -264.16537475586,-264.51245117188,38.991146087646);
    SetPlayerCameraLookAt(playerid, -220.18283081055,-230.36674499512,3.742974281311);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos5", 25000, false, "i", playerid);
}

forward CamPos5(playerid);
public CamPos5(playerid)
{
    SetPlayerCameraPos(playerid, 2443.337890625,-1637.2966308594,47.733604431152);
    SetPlayerCameraLookAt(playerid, 2486.9802246094,-1665.4174804688,13.934108734131);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos6", 25000, false, "i", playerid);
}

forward CamPos6(playerid);
public CamPos6(playerid)
{
    SetPlayerCameraPos(playerid, 1923.3879394531,-2475.5227050781,73.944648742676);
    SetPlayerCameraLookAt(playerid, 1992.751953125,-2410.1789550781,20.21329498291);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos7", 25000, false, "i", playerid);
}

forward CamPos7(playerid);
public CamPos7(playerid)
{
    SetPlayerCameraPos(playerid, -2526.9975585938,553.82147216797,78.051513671875);
    SetPlayerCameraLookAt(playerid, -2590.4067382813,613.92309570313,33.101581573486);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos8", 25000, false, "i", playerid);
}

forward CamPos8(playerid);
public CamPos8(playerid)
{
    SetPlayerCameraPos(playerid, -2002.6124267578,305.96759033203,53.533226013184);
    SetPlayerCameraLookAt(playerid, -1970.1141357422,287.712890625,36.697841644287);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos9", 25000, false, "i", playerid);
}

forward CamPos9(playerid);
public CamPos9(playerid)
{
    SetPlayerCameraPos(playerid, -2453.6552734375,720.6904296875,38.775897979736);
    SetPlayerCameraLookAt(playerid, -2440.7619628906,752.48333740234,34.690937042236);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos10", 25000, false, "i", playerid);
}

forward CamPos10(playerid);
public CamPos10(playerid)
{
    SetPlayerCameraPos(playerid, 112.12654876709,1966.6202392578,74.79239654541);
    SetPlayerCameraLookAt(playerid, 153.72250366211,1905.8748779297,26.862028121948);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("CamPos11", 25000, false, "i", playerid);
}

forward CamPos11(playerid);
public CamPos11(playerid)
{
    SetPlayerCameraPos(playerid, -1638.8967285156,1540.8626708984,173.04640197754);
    SetPlayerCameraLookAt(playerid, -1735.0487060547,1317.1358642578,55.50150680542);
    ClearChat(playerid);
    SendClientMessage(playerid, COLOR_ORANGE, "[YOUR SERVER] - [Quick Start Guide] TEXT HERE");
    SendClientMessage(playerid, COLOR_YELLOW, "Text Here"
    Tutorial_Timer[playerid] = SetTimerEx("FinishTut", 25000, false, "i", playerid);
}

forward FinishTut(playerid);
public FinishTut(playerid)
{
    ClearChat(playerid);
    SetSpawnInfo( playerid, 0, PlayerInfo[playerid][pSkin], -1972.4609,116.7860,27.6940,179.2567,0,0,0,0,0,0 );
    TogglePlayerSpectating(playerid, 0);
    Tutorial[playerid] = 0;
}

public OnPlayerSpawn(playerid)
{
    if(Tutorial[playerid] == 1)
    {
        Tutorial[playerid] = 1;
        TogglePlayerSpectating(playerid, 1);
        SetTimerEx("CamPos1", 1000, false, "i", playerid);
        return 1;
    }
    return 1;
}
Reply
#4



pawn Код:
Tutorial[playerid] = 1;
Reply
#5

Did you put at the top

new Tutorial[MAX_PLAYERS];
Reply
#6

@Phil

The best way to do the camera's is like this:

pawn Код:
forward Cameras(playerid, id);
public Cameras(playerid, id)
{
    switch(id)
    {
        case 1: //camera 1 positions
        case 2: //camera 2 positions
        case 3: //camera 3 positions
        case 4: //camera 4 positions
    }
    return 1;
}

//to set the actual position by timer, use:
SetTimerEx("Cameras", 3000, false, "ii", playerid, 1); //Where "1" is the camera ID.
Reply
#7

It was giving too many errors so I decided not to use it, Phil. Can anybody else help me?
Reply
#8

Phil's one is working fine for me, eh..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)