Spawning after register/login?
#1

Hello guys!

I used this tutorial to make the login/register system, and I have already made where I shall spawn before I added the register/login system, but I want to make it "autospawn" after login register. I've the cordinates, but I need the code. Used this tutorial btw: https://sampforum.blast.hk/showthread.php?tid=273088

Anyone?
Reply
#2

You want when a players register or login, he will automatically spawn? If it's that use :
pawn Код:
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
Reply
#3

Where shall I place it? Newbie, ya' know
Reply
#4

Hm.. I already have that but it dosen't work

This is my code:
Quote:

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Register",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",5000);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);

SetSpawnInfo(playerid, 0, 0,1685.5651,-2240.3220,-2.6995,184.5384,0,0,0,0,0,0);
SpawnPlayer(playerid);
}
}

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]);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Yo u have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}

Reply
#5

Try this code if it works. also i changed some code.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REGISTER)
    {
    if (!response)
        return Kick(playerid);
    if(response)
    {
        if(!strlen(inputtext))
            return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Register",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
        new INI:File = INI_Open(UserPath(playerid));
        INI_SetTag(File,"data");
        INI_WriteInt(File,"Password",udb_hash(inputtext));
        INI_WriteInt(File,"Cash",5000);
        INI_WriteInt(File,"Admin",0);
        INI_WriteInt(File,"Kills",0);
        INI_WriteInt(File,"Deaths",0);
        INI_Close(File);

        SetSpawnInfo(playerid, 0, GetPlayerSkin(playerid), 1633.7120, -2330.5198, 13.5469, 245.0, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
        }
    }

    if(dialogid == 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]);
            } else {
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Yo u have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
            }
        }
    }
    return 1;
    }
Reply
#6

I'll try it later, anyways thank you
Reply
#7

Nope, it didn't work. I added it, and I have to press spawn now as well, but when I press spawn it says "Stay in the world boundaries" and the game crashes, but it didn't auto spawn.
Reply
#8

You need to add classes in the server for the world boundaries, i think it will fix the spawn button thing too!

https://sampwiki.blast.hk/wiki/AddPlayerClass

If you use the login and register systems in a gamemode, put them in OnGameModeInIt, if you use them in a filterscript, put them in OnFilterScriptInIt.
Reply
#9

I want auto spawn, the spawn button is fixed but not the auto spawn.
Reply
#10

SpawnPlayer(playerid);?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)