23.07.2016, 16:11
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:
I've quickly written an example of what I exactly mean:
PHP код:
new
choosenClass[MAX_PLAYERS];
public OnGameModeInit() {
AddPlayerClass(0, -2455.8235, 2292.9785, 4.9785, 324.5504, 0, 0, 0, 0, 0, 0); // case 0
return true;
}
public OnPlayerConnect(playerid) {
TogglePlayerSpectating(playerid, true);
// Load data - show correct dialog
return true;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
switch(dialogid) {
case DIALOG_LOGIN: {
// Authenticate account
ForceClassSelection(playerid);
TogglePlayerSpectating(playerid, false); // Player goes back to class selection
}
// ...
}
return false;
}
public OnPlayerRequestClass(playerid, classid) {
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;
}

