The way you spawn a player is irrelevant.
PHP код:
#include <a_samp>
#undef MAX_PLAYERS
#define MAX_PLAYERS 1
new class_id[MAX_PLAYERS];
main() { }
public OnGameModeInit() {
AddPlayerClass(0, 5.0, 5.0, 5.0, 180.0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(5, 10.0, 5.0, 5.0, 180.0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(10, 13.0, 5.0, 5.0, 180.0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(15, 15.0, 5.0, 5.0, 180.0, 0, 0, 0, 0, 0, 0);
return true;
}
public OnGameModeExit() {
return true;
}
public OnPlayerConnect(playerid) {
return true;
}
public OnPlayerRequestClass(playerid, classid) {
class_id[playerid] = classid;
return true;
}
public OnPlayerRequestSpawn(playerid) {
if(class_id[playerid] == 0) {
// CJ
SetSpawnInfo(playerid, 0, 0, 30.0, 5.0, 5.0, 180.0, 0, 0, 0, 0, 0, 0);
}
SpawnPlayer(playerid);
return true;
}
public OnPlayerCommandText(playerid, cmdtext[]) {
if(!strcmp(cmdtext, "/kill", true)) {
SetPlayerHealth(playerid, 0.0);
return true;
}
if(!strcmp(cmdtext, "forceselection", true)) {
ForceClassSelection(playerid);
TogglePlayerSpectating(playerid, true);
TogglePlayerSpectating(playerid, false);
return true;
}
return false;
}
I first spawned as CJ to set the spawn info. I then pressed F4 and killed myself. I picked a different class and spawned on the same location as specified in SetSpawnInfo.