SA-MP Forums Archive
I am attempting to skip class selection, but it doesn't work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I am attempting to skip class selection, but it doesn't work (/showthread.php?tid=643402)



I am attempting to skip class selection, but it doesn't work - EtayJ - 19.10.2017

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    print(
"Request class!");
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}
forward InstantSpawn(playerid);
public 
InstantSpawn(playerid)
{
    
TogglePlayerSpectating(playerid0);
    
TogglePlayerControllable(playerid1);
    
SpawnPlayer(playerid);
}
public 
OnHashCheck(playerid)
{
    
//...... your typical password compare stuff
    
if(!match)
        
KickPlayer(playerid"Wrong password!");
    
SetTimerEx("InstantSpawn"10"i"playerid);
    return 
1;

I would love to get some help, I don't know what I am doing wrong (And before you ask, I did verify that OnHashCheck is being called);


Re: I am attempting to skip class selection, but it doesn't work - kAn3 - 19.10.2017

PHP код:
OnPlayerConnect(playerid)
{
// ............. Code
return InstantSpawn(playerid);




Re: I am attempting to skip class selection, but it doesn't work - EtayJ - 19.10.2017

Thanks but I still get the class selection screen.


Re: I am attempting to skip class selection, but it doesn't work - Lucases - 19.10.2017

Код HTML:
public OnPlayerConnect(playerid)
{
    SetSpawnInfo(playerid, ANYCORDS, ANYCORDS, ANYCORDS, ANYANGLE, -1, 0, -1, 0, -1, 0);
    SpawnPlayer(playerid);
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); 
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); 
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); 
    return 1; 
}
I just made the player spawn under OnPlayerConnect, so OnPlayerRequestClass won't be called.
This will prevent "Spawn" button show.
Replace all "ANYCORDS" with any cords, anyway you'll set the player pos after the spawn with this code.
Remember to change player pos and to set the camera behind the player after login/register dialog.
I hope I helped you.


Re: I am attempting to skip class selection, but it doesn't work - EtayJ - 19.10.2017

Thanks guys.