Force class selection after OnPlayerRequestClass return 0
#1

I'm making a login system which prevents displaying classes for a player until login:
Код:
public OnPlayerRequestClass(playerid, classid)
{
    if (!Players[playerid][IsLoggedIn])
    {
        LoadPlayer(playerid);
        return 0;
    }
    else
    {
        SetClassSelectionCamera(playerid);
        return 1;
    }
}
It works good, no classes are shown. The problem is that after a player is logged in, it does not show the classes automatically, the player have to click on arrow button to see a class. I tried ForceClassSelection with and without TogglePlayerSpectating/SpawnPlayer, but no luck:
Код:
OnPlayerLoggedIn(playerid)
{
    ForceClassSelection(playerid);
    SpawnPlayer(playerid);
    TogglePlayerSpectating(playerid, true);
    TogglePlayerSpectating(playerid, false);
}
The only solution I found is to actually spawn player and get him back to class selection:
Код:
OnPlayerLoggedIn(playerid)
{
    ForceClassSelection(playerid);
    SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
    SpawnPlayer(playerid);
    TogglePlayerSpectating(playerid, true);
    TogglePlayerSpectating(playerid, false);
}
But I don't like it because it shows the spawned player for some time before return to class selection. Is there a better solution?
Reply


Messages In This Thread
Force class selection after OnPlayerRequestClass return 0 - by Morion - 03.09.2014, 05:27
Re: Force class selection after OnPlayerRequestClass return 0 - by LeroyII - 03.09.2014, 07:12
Re: Force class selection after OnPlayerRequestClass return 0 - by 5194Hercules - 03.09.2014, 07:35
Re: Force class selection after OnPlayerRequestClass return 0 - by LeroyII - 03.09.2014, 07:53
Re: Force class selection after OnPlayerRequestClass return 0 - by Morion - 03.09.2014, 10:09

Forum Jump:


Users browsing this thread: 1 Guest(s)