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?
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
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(playerid, 0, 299, 982.1890, -1624.2583, 14.9526, 90, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
ResetPlayerWeapons(playerid);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerScore(playerid, 1);
GivePlayerMoney(playerid, 1000);
SetCameraBehindPlayer(playerid);
PlayerInfo[playerid][pSkin] = 299;
PlayerInfo[playerid][pInt] = 0;
PlayerInfo[playerid][pVW] = 0;
PlayerInfo[playerid][pLevel] = 1;
SendClientMessage(playerid, COLOR_YELLOW, "Account registered, you have been logged in automatically!");
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~ %s", GetName(playerid));
GameTextForPlayer(playerid, tmp2, 5000, 1);
TogglePlayerSpectating(playerid, 0);
}
}
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(playerid, 0, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], PlayerInfo[playerid][pFacingAngle], 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
SetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
SetPlayerInterior(playerid, PlayerInfo[playerid][pInt]);
SetPlayerVirtualWorld(playerid, PlayerInfo[playerid][pVW]);
format(tmp2, sizeof(tmp2), "~w~Welcome ~n~~y~ %s", GetName(playerid));
GameTextForPlayer(playerid, tmp2, 5000, 1);
if(PlayerInfo[playerid][pAdmin] >= 1)
{
format(tmp2, sizeof(tmp2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_WHITE,tmp2);
ShowPlayerDialog(playerid, 3,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.
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.
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.
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.