SA-MP Forums Archive
Problems with spawning - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problems with spawning (/showthread.php?tid=203002)



Problems with spawning - Anthonyx3' - 25.12.2010

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.


Re: Problems with spawning - Mean - 25.12.2010

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.
}



Re: Problems with spawning - Anthonyx3' - 25.12.2010

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


Re: Problems with spawning - Mean - 25.12.2010

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


Re: Problems with spawning - Anthonyx3' - 25.12.2010

Alright, should i use setspawninfo?


Re: Problems with spawning - Mean - 26.12.2010

Yes.


Re: Problems with spawning - Anthonyx3' - 26.12.2010

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.



Re: Problems with spawning - Mean - 27.12.2010

No problem .