Problems with spawning
#1

Hey guys, im having some difficulties with my spawning. Ofcourse, im trying to bypass << >> spawn, and i think i pretty much did that, im just running into problems where i spawn and stuff.

My code:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerCameraPos(playerid, -2658.7156,633.3684,14.4531);
    SetPlayerCameraLookAt(playerid, -2658.7156,633.3684,14.4531);
    SetPlayerPos(playerid, -2658.7156,633.3684,14.4531);
    SetSpawnInfo(playerid, PlayerInfo[playerid][pFaction], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][X1], PlayerInfo[playerid][Y1], PlayerInfo[playerid][Z1], 1.0, -1, -1, -1, -1, -1, -1);
    SpawnPlayer(playerid);
    return 1;
}
pawn Код:
if(response)
          {
                PlayerInfo[playerid][pFaction] = 0;
                PlayerInfo[playerid][pGender] = 1;
                SendClientMessage(playerid, COLOR_RED, "Ok. So your character is MALE");
                SpawnPlayer(playerid);
                SetPlayerPos(playerid, -2658.7156,633.3684,14.4531);
                SetPlayerSkin(playerid, 29);
                PlayerInfo[playerid][Logged] = 1;

          }
          else
          {
                PlayerInfo[playerid][pFaction] = 0;
                SetPlayerSkin(playerid, 29);
                PlayerInfo[playerid][pGender] = 2;
                SendClientMessage(playerid, COLOR_RED, "Ok. So your character is FEMALE");
                SpawnPlayer(playerid);
                SetPlayerPos(playerid, -2658.7156,633.3684,14.4531);
                SetPlayerSkin(playerid, 12);
                PlayerInfo[playerid][Logged] = 1;
          }
    }
Thats what sending the spawn or whatever. The problem is, it doesnt set my pos, and im like falling from the sky, when i register, heading into the dialog for gender. When the dialog shows up i start falling from the sky, how could i fix this? Thanks in advance.
Reply
#2

So you want a player to spawn without class selection?
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetSpawnInfo(playerid, PlayerInfo[playerid][pFaction], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][X1], PlayerInfo[playerid][Y1], PlayerInfo[playerid][Z1], 1.0, -1, -1, -1, -1, -1, -1);
    return 0;// returning false so player doesn't get in class selection.
}
Reply
#3

So just changing to return 0 would completely ignore the class selection? how about the whole falling from the sky thing
Reply
#4

Yes return 0; ignores it.
You fix the falling from sky by adding SetPlayerPos to OnPlayerSpawn.
Reply
#5

Alright, should i use setspawninfo?
Reply
#6

Yes.
Reply
#7

Thanks for your help, i finally got it all working.
pawn Код:
This forum requires that you wait 60 seconds between posts. Please try again in 11 seconds.
Reply
#8

No problem .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)