Save last pos not working upon serv restart
#9

I'm a bit confused now. Sending the player to class selection shouldn't be a thing since he will be in it upon connecting. Unless you are toggling on spectate mode, which in that case you forgot to toggle it off. Moreover, spawning the player to send him to class selection seems odd to me when you have a native function to do that: https://sampwiki.blast.hk/wiki/ForceClassSelection , I could be wrong - it's been a long time since I've used the class selection screen.

I've quickly written an example of what I exactly mean:
PHP код:
new 
    
choosenClass[MAX_PLAYERS];

public 
OnGameModeInit() {

    
AddPlayerClass(0, -2455.82352292.97854.9785324.5504000000); // case 0
    
return true;
}

public 
OnPlayerConnect(playerid) {

    
TogglePlayerSpectating(playeridtrue);

    
// Load data - show correct dialog
    
return true;
}

public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[]) {

    switch(
dialogid) {

        case 
DIALOG_LOGIN: {

            
// Authenticate account

            
ForceClassSelection(playerid);
            
TogglePlayerSpectating(playeridfalse); // Player goes back to class selection
        
}
        
// ...
    
}
    return 
false;
}

public 
OnPlayerRequestClass(playeridclassid) {

    switch(
classid) {

        case 
0: {

            
choosenClass[playerid] = 0;
            
// Camera positions and such
        
}
    }
    return 
true;
}

public 
OnPlayerRequestSpawn(playerid) {

    switch(
choosenClass[playerid]) {

        case 
0: {

            
// CJ
            
SetSpawnInfo(playerid, ...); // The coords from AddPlayerClass under OnGameModeInit don't support dynamic coords, hence why you have to set them here.
        
}
    }
    return 
true;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)