How to spawn after login/register
#1

HI guys !

This is my first Thread and I'm not sure how it goes here but here is the question:
On player login sucsess or register sucsess automaticly spawn player
And if player request class change on next death just spawns him again, how to do that ?

P.S I've already done register/login system

P.P.S My english isnt so good

Looking forward to hearing from you !! Thanks!
Reply
#2

Just put this -
pawn Код:
SpawnPlayer(playerid);
Reply
#3

Quote:
Originally Posted by Phyzic
Посмотреть сообщение
Just put this -
pawn Код:
SpawnPlayer(playerid);
Yeah I've already done it but if wont work :/
maby i put it in wrong place ?
Heres the code

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == dregister)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                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;
            }
           
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new INI:file = INI_Open(Path(playerid));
            INI_SetTag(file,"Player's Data");
            INI_WriteString(file,"Password",hashpass);
            INI_WriteInt(file,"Admin",0);
            INI_WriteInt(file,"VIP",0);
            INI_WriteInt(file,"Money",0);
            INI_WriteInt(file,"Level",0);
            INI_WriteInt(file,"Kills",0);
            INI_WriteInt(file,"Deaths",0);
            INI_WriteInt(file,"Leader",0);
            INI_WriteInt(file,"Member",0);
            INI_WriteInt(file,"Rank",0);
            INI_WriteInt(file,"Char",0);
            INI_WriteInt(file,"Model",0);
            INI_Close(file);
            SCM(playerid,-1,"You have been successfully registered");
            PlayerInfo[playerid][pLoggedIn] = 1;
        SpawnPlayer(playerid);     
            SetPlayerScore(playerid, 2);
            GivePlayerMoney(playerid, 100000);
            return 1;
        }
    }
    if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(!strcmp(hashpass, PlayerInfo[playerid][Pass], false))
            {
                INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
                SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
                GivePlayerMoney(playerid,PlayerInfo[playerid][pMoney]);
                SCM(playerid,-1,"Welcome back! You have successfully logged in");
                PlayerInfo[playerid][pLoggedIn] = 1;
                SpawnPlayer(playerid);
            }
            else
            {
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_PASSWORD,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
                return 1;
            }
        }
    }
Thanks again!
Reply
#4

Anyone? Please ?
Reply
#5

When I put this it spawns me automaticly, pOrg == pMember or pLeader, but when im not neither a member or leader it spawns me on a same place like when im pOrg == 1 but the interior id is 0.
If anyone can help me with this please
Here's the code
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(PlayerInfo[playerid][pOrg] == 1)
    {
        SetPlayerInterior(playerid, 6);
        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pChar], 220.2602,77.8079,1005.0391,0,0,0,0,0,0,0);
    }
    else if(PlayerInfo[playerid][pOrg] == 0)
    {
        SetPlayerInterior(playerid, 0);
        SetSpawnInfo(playerid, 0, 0, 1546.1136,-1675.5836,13.5617,0,0,0,0,0,0,0);
    }
    SpawnPlayer(playerid);
    return 1;
}
Thanks!
Reply
#6

Never mind I figured it out myself its the best to do it by yourself you learn something new btw
For everyone who doesnt know:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetSpawnInfo(playerid, 0,0,0,0,0,0,0,0,0,0,0,0);
    SpawnPlayer(playerid);
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerInterior(playerid, your interior id here);
    SetPlayerPos(playerid, your position here);
    //SetCameraBehindPlayer(playerid)// not nessesery but its better like this at least to me :D
    return 1;
}
Thanks hope I helped !

P.S: This was my first thread and I figured my problem by myself
Reply
#7

Код:
SetSpawnInfo(playerid, 0,0,0,0,0,0,0,0,0,0,0,0);
This SpawnInfo you will come out to the farm, I hope you is known.
Reply
#8

Quote:
Originally Posted by CIBERKILLER
Посмотреть сообщение
Код:
SetSpawnInfo(playerid, 0,0,0,0,0,0,0,0,0,0,0,0);
This SpawnInfo you will come out to the farm, I hope you is known.
Yup I do and then just teleport player with SetPlayerPos
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)