02.03.2016, 12:15
So, you need to instantly Spawn the player in OnPlayerRequestClass and make a global array for all players (like bool:InSpawnSel[MAX_PLAYERS]) and an array for the currently selected class (custom class, not SAMP class).
In OnPlayerRequestClass do:
In OnPlayerSpawn:
CustomSpawn function:
So you have to move your OnPlayerSpawn code to the CustomSpawn function (except code regarding the custom class sel).
In OnPlayerClickTextDraw check if the player is in the custom spawn selection.
Once the player clicks the button that should make him spawn hide all textdraws and set InSpawnSel to false for that player and then call CustomSpawn.
After that the player should be able to re-enter it using F4.
If he still enters the spawn selection after death (without using F4) there is something else wrong.
You should btw never call ForceClassSelection since it makes the player constantly re-entering it.
Also freeze/unfreeze the player properley, else he will be able to move.
In OnPlayerRequestClass do:
Код:
SpawnPlayer(playerid); InSpawnSel[playerid] = true;
Код:
if(InSpawnSel[playerid]) { // show textdraws, update skin (until this point the player will have default skin from AddPlayerClass) and camera/player pos stuff for the current skin (with the second array I mentioned above) } else { CustomSpawn(playerid); }
Код:
CustomSpawn(playerid) { // do stuff you would do on every spawn }
In OnPlayerClickTextDraw check if the player is in the custom spawn selection.
Once the player clicks the button that should make him spawn hide all textdraws and set InSpawnSel to false for that player and then call CustomSpawn.
After that the player should be able to re-enter it using F4.
If he still enters the spawn selection after death (without using F4) there is something else wrong.
You should btw never call ForceClassSelection since it makes the player constantly re-entering it.
Also freeze/unfreeze the player properley, else he will be able to move.