Why does anyone who logs in infinitely fall?
#1

Basically the first time you register your account it's all fine and dandy and you're spawned at the point. But when you relog and come back you just infinitely fall after the login menu. I don't really know why, can someone help me?

I'll post some of this code as maybe it'll help:

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
tmp2[256];
    if(
IsPlayerConnected(playerid))
    {
        if(
dialogid == 1)
        {
            if (!
response) return Kick(playerid);
             if(
response)
              {
                   if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Register","Welcome to Chicago Streets Roleplay.\n\nPlease register your account by typing your password below.","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,"Skin",0);
                 
INI_WriteInt(File,"Level",0);
                 
INI_WriteInt(File,"Int",0);
                 
INI_WriteInt(File,"VW",0);
                 
INI_WriteInt(File,"Admin",0);
                 
INI_WriteInt(File,"SecKey",0);
                 
INI_WriteInt(File,"Kills",0);
                 
INI_WriteInt(File,"Deaths",0);
                   
INI_WriteFloat(File,"FacingAngle",0);
                
INI_WriteFloat(File,"Health",0);
                
INI_WriteFloat(File,"Armour",0);
                
INI_WriteFloat(File,"LastX",0);
                
INI_WriteFloat(File,"LastY",0);
                
INI_WriteFloat(File,"LastZ",0);
                 
INI_Close(File);
                
SetSpawnInfo(playerid0299982.1890, -1624.258314.952690000000);
                   
SpawnPlayer(playerid);
                
ResetPlayerWeapons(playerid);
                
SetPlayerInterior(playerid,0);
                
SetPlayerVirtualWorld(playerid0);
                
SetPlayerScore(playerid1);
                
GivePlayerMoney(playerid1000);
                
SetCameraBehindPlayer(playerid);
                
PlayerInfo[playerid][pSkin] = 299;
                
PlayerInfo[playerid][pInt] = 0;
                
PlayerInfo[playerid][pVW] = 0;
                
PlayerInfo[playerid][pLevel] = 1;
                
SendClientMessage(playeridCOLOR_YELLOW"Account registered, you have been logged in automatically!");
                   
format(tmp2sizeof(tmp2), "~w~Welcome ~n~~y~   %s"GetName(playerid));
                
GameTextForPlayer(playeridtmp250001);
                
TogglePlayerSpectating(playerid0);
            }
           }
        if(
dialogid == 2)
           {
            if ( !
response ) return Kick playerid );
               if( 
response )
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                 {
                      
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                      
SetSpawnInfo(playerid0PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], PlayerInfo[playerid][pFacingAngle], 000000);
                    
SpawnPlayer(playerid);
                      
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                      
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
                      
SetPlayerScore(playeridPlayerInfo[playerid][pLevel]);
                    
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
                    
SetPlayerArmour(playeridPlayerInfo[playerid][pArmour]);
                    
SetPlayerInterior(playeridPlayerInfo[playerid][pInt]);
                    
SetPlayerVirtualWorld(playeridPlayerInfo[playerid][pVW]);
                       
format(tmp2sizeof(tmp2), "~w~Welcome ~n~~y~   %s"GetName(playerid));
                    
GameTextForPlayer(playeridtmp250001);
                    if(
PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        
format(tmp2sizeof(tmp2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
                        
SendClientMessage(playeridCOLOR_WHITE,tmp2);
                        
ShowPlayerDialog(playerid3,DIALOG_STYLE_INPUT,"Admin Login","Please provide your security code for your admin account to be authorized.\n\nPlease enter your security code below.","Login","Quit"); //admin authorization
                    
}
                 }
                   else
                   {
                       
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Login","Welcome back to CHANGEME.\n\nThat name is registered. Please enter your password below.","Login","Quit");
                   }
                   return 
1;
            }
        } 
Edit: I'm not quite sure the problem lies in this code either but if you need more just let me know.
Reply
#2

I'm guessing you call these dialogs before class selection? Show us OnPlayerRequestClass, OnPlayerRequestSpawn, and OnPlayerSpawn. The problem most likely lies within one of those.
Reply
#3

Код:
public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

They're all quite empty. Is it that I need to make a class selection although I don't want them to be able to do that?
Reply
#4

Try
Код:
public OnPlayerConnect(playerid)
{
	TogglePlayerSpectating(playerid, true); // just add this to your connect
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	TogglePlayerSpectating(playerid, false);
	SpawnPlayer(playerid);
	return 1;
}
Reply
#5

Unfortunately that didn't solve the issue. I even removed TogglePlayerSpectating from the registration to see if that would fix it, and it hasn't. Any more ideas? I saw what you were trying to do with that and it made sense but for some reason it didn't fix it.
Reply
#6

I figured it out. It was some real bullshit but I got it. Thanks for your help dude it pretty much solved the issue in the end.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)