0.3z bug: Can't use SpawnPlayer while player is in class selection.
#1

Hey I've tried to spawn a player using SetSpawnInfo and SpawnPlayer in OnPlayerConnect.
It will spawn the player, but the player cannot control himself.
I tried TogglePlayerControllable, but it does not work.

I think this is a 0.3z bug because this used to work in earlier versions to force spawn a player on connect.
Does anyone know how to fix the bug or work around it?
Reply
#2

how exacly do u mean that?

/EDIT Please Show us the code
Reply
#3

pawn Код:
public OnPlayerConnect(playerid) {
    // Player is in class selection by default.
    SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
    SpawnPlayer(playerid); // Should force spawn the player out of class selection and in Blueberry farm.
    TogglePlayerControllable(playerid, 1); // does not work, player still can't control themself.
    return 1;
}
Try it yourself, won't work.
This method use to work before 0.3z releases.
Reply
#4

Quote:
Originally Posted by SkittlesAreFalling
Посмотреть сообщение
This method use to work before 0.3z releases.
I'm not really sure about this. However, OnPlayerConnect isn't always safe to add many codes. Spawning the player should be delayed and that's why OnPlayerRequestClass is better than using OnPlayerConnect. Run a timer of 250 milliseconds to ensure that OnPlayerConnect is safe to be used if you're trying to run something which is followed by OnPlayerConnect.
Reply
#5

I have my SpawnPlayer under OnPlayerRequestClass and it works fine I recommend you to do the same and test it as Lordzy above me said.
Reply
#6

Wait misread, yeah it's a work-around but I wish you can use it OnPlayerConnect.
Reply
#7

OnPlayerConnect isn't the correct use because it's called when the Player connects, everything didn't load fine as you may know then if you instantly spawn him it would lead into some huge lags/bugs.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)