Still can't fix it
#1

Hi, it's me (again..). Last night I posted thread about dialog problem and I didn't get much help so I'll post a video now so you can see the exact problem I'm having:
Here's the video
http://www.youtube.com/watch?v=zltHE...ature=*********

Here's the code of how it looks (note: I'm not having a problem with registering but only with login. If I put "SpawnPlayer(playerid);" under the login part still same thing. Player doesn't spawn..
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case 2:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""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",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
            }
        }

        case 1:
        {
            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, 1, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ]);
    return 1;
}
Reply
#2

Anyone?
Reply
#3

Are you sure your data is loading correctly?
Reply
#4

Actually
pawn Код:
SetSpawnInfo( playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0 );
SpawnPlayer( playerid );
are awful on this part, because player isn't able to choose skin while the Register/Login is on Dialogs.
Just delete them and let players choose skin. After the "SPAWN" Button should work and spawn them.
Reply
#5

That's the point, player isn't allowed to change skin there. It's a rp mod and he need to go to clothes shop or something...
Reply
#6

Quote:
Originally Posted by Fmfan
Посмотреть сообщение
That's the point, player isn't allowed to change skin there. It's a rp mod and he need to go to clothes shop or something...
i dont understand why you put

Код:
 if ( !response ) return Kick ( playerid );
            if( response )
put only: if ( !response ) return Kick ( playerid );
Reply
#7

pawn Код:
if ( !response ) return Kick ( playerid );
this is if player click second button (quit) server kicks him

pawn Код:
if( response )
and this is the first button
Reply
#8

Quote:
Originally Posted by [V]PawnFox
Посмотреть сообщение
i dont understand why you put

Код:
 if ( !response ) return Kick ( playerid );
            if( response )
put only: if ( !response ) return Kick ( playerid );
A lot of ways work.
pawn Код:
// 1st:
if( !response ) return Kick( playerid );
if( response )
{
    // Code
}

// 2nd:
if( !response ) return Kick( playerid );
else
{
    // Code
}

// 3rd:
if( !response ) return Kick( playerid );
// Code
Quote:
Originally Posted by Fmfan
Посмотреть сообщение
That's the point, player isn't allowed to change skin there. It's a rp mod and he need to go to clothes shop or something...
oh, okay. I didn't know that!
Reply
#9

Call On This In The dialog when player Logins In..
pawn Код:
SpawnLastKnownPos(playerid);

forward SpawnLastKnownPos(playerid);
public SpawnLastKnownPos(playerid)
{
    SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],0,0,0,0,0,0,0,0,0,0);
    SpawnPlayer(playerid);
    SetPlayerPos(playerid, PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ]);
    return 1;
}
Thats if you Are Planning On Saving There Pos On Exit.. I Know i put PlayerInfo[playerid][pSkin] Thats what i added to mine To Avoid That Server Closed Connection Problem..
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)