TogglePlayerSpectating(playerid, 1);
public OnPlayerRequestClass(playerid, classid) { TogglePlayerSpectating(playerid, 1); if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit"); } return 1; }
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_PASSWORD, ""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"); new HashPass[129]; WP_Hash(HashPass, sizeof(HashPass), inputtext); INI_WriteString(File, "Password", HashPass); INI_WriteInt(File,"Cash",1000); INI_WriteInt(File,"Skin",1); INI_WriteInt(File,"AdminLevel",0); INI_WriteInt(File,"Vip",0); INI_Close(File); TogglePlayerSpectating(playerid, 0); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { new HashPass[129]; WP_Hash(HashPass, sizeof(HashPass), inputtext); if(strcmp(HashPass, PlayerInfo[playerid][pPass]) == 0) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); TogglePlayerSpectating(playerid, 0); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok",""); SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] ); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""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; }
So here's my issue, i have
Код:
case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { new HashPass[129]; WP_Hash(HashPass, sizeof(HashPass), inputtext); if(strcmp(HashPass, PlayerInfo[playerid][pPass], true) == 0) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); TogglePlayerSpectating(playerid, 0); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok",""); SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] ); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""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; } |
Try adding what's in green. Also, your login dialog doesn't spawn the player.
|
TogglePlayerSpectating(playerid, 0);
When spectator mode is disabled, OnPlayerSpawn will automatically be called. |
public OnPlayerSpawn(playerid) { if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 && Angle[ playerid ] != 0 ) { SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] ); SetPlayerFacingAngle( playerid, Angle[ playerid ] ); SetPlayerInterior( playerid, Interior[ playerid ] ); SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] ); } return 1; }
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
I beleive this is the Dialog which spawns the player
pawn Код:
|
case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { new HashPass[129]; WP_Hash(HashPass, sizeof(HashPass), inputtext); if(strcmp(HashPass, PlayerInfo[playerid][pPass]) == 0) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); TogglePlayerSpectating(playerid, 0); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok",""); SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
Try adding what's in green. |
But as you can see, i highlighted the "TogglePlayerSpectating" code which should do it.
|
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
new HashPass[129];
WP_Hash(HashPass, sizeof(HashPass), inputtext);
if(strcmp(HashPass, PlayerInfo[playerid][pPass]) == 0)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
TogglePlayerSpectating(playerid, 0);
SpawnPlayer(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
pawn Код:
|