Spawning
#1

How do i make it when you login it shows camera on your spawn spot.

Say you logged out at 1751.5665,-1945.2590,13.5636 then when your login it would show those coords on camera?

If thats not possible how do i just set a camera instead of it showing your falling from the sky.
Reply
#2

Well to make it so that it shows the character selection in a place do this:

Код:
 	
SetPlayerPos(playerid, [Coords to put player]);
SetPlayerCameraPos(playerid, [Coords of camera]);
SetPlayerCameraLookAt(playerid, [What camera looks at]);
A Example is this:
Код:
SetPlayerPos(playerid, 1962.4459,1343.0460,15.4823);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
If you want you can use it, it pretty much makes the player show up infront of the camera and they can select their skin and then they spawn at the addplayerclass coords.
Reply
#3

Are you talking about saving player position?
Reply
#4

You would realy need to tell us what file system you use (y_ini, dini djson and mysql ect). And show the code where it saves the players position when they logout (if you do have such code). Not the easiest thing for the begginer (not saying you are a begginer).
Reply
#5

Sorry guys i completely forgot about this thread and continued scripting xD

pawn Код:
GetPlayerPos(playerid, X, Y, Z);
        PlayerInfo[playerid][pPos_X] = X;
        PlayerInfo[playerid][pPos_Y] = Y;
        PlayerInfo[playerid][pPos_Z] = Z
pawn Код:
dini_FloatSet(file, "Posx",PlayerInfo[playerid][pPos_X]);
        dini_FloatSet(file, "Posy",PlayerInfo[playerid][pPos_Y]);
        dini_FloatSet(file, "Posz",PlayerInfo[playerid][pPos_Z]);
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerCameraPos(playerid, 1751.5665,-1945.2590,13.5636);
    SetPlayerCameraLookAt(playerid, 1751.5665,-1945.2590,13.5636);
    SetSpawnInfo(playerid, PlayerInfo[playerid][pFaction], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPos_X], PlayerInfo[playerid][pPos_Y], PlayerInfo[playerid][pPos_Z], 1.0, -1, -1, -1, -1, -1, -1);
    SpawnPlayer(playerid);
    return 1;
}
I use dini if you didnt notice xD
Reply
#6

Did it work the way you wanted it too?
Reply
#7

You spawn where you last logged, the problem is before you actually load, you start falling from sky. During register before you pick your sex you start falling from sky, then it puts you at correct spot. I want to remove the whole falling thing
Reply
#8

Oh well OnPlayerConnect callback put your desired Location there

SetPlayerPos(playerid, 1962.4459,1343.0460,15.4823); // note this is Sarah Post hehe thx sarah need a fast reply
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);

And another thing make sure you dont have SpawnPlayer(playerid); after register and when the gender is asked makre sure there no spawn there...
Reply
#9

i set it there because i want to bypass << >> spawn
Reply
#10

Try this, not sure if it will work 100% though so you change it to your script ^-^:

Код:
public OnPlayerRequestClass(playerid, classid)
{
	new name[MAX_PLAYER_NAME], file[256];
	GetPlayerName(playerid, name, sizeof(name));
	format(file, sizeof(file), SERVER_USER_FILE, name);
	if(dini_Int(file, "Skin"))
	{
	SetPlayerSkin(playerid, dini_Int(file, "Skin"));
	SetPlayerPos(playerid, 1962.4459,1343.0460,15.4823);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerSkin(playerid, dini_Int(file, "Skin"));
	}
	else if (!dini_Int(file, "Skin"))
	{
	SetPlayerPos(playerid, 1962.4459,1343.0460,15.4823);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	}
	return 1;
}
Then do:

Код:
public OnPlayerRequestSpawn(playerid)
{
SetPlayerCameraPos(playerid, 1751.5665,-1945.2590,13.5636);
SetPlayerCameraLookAt(playerid, 1751.5665,-1945.2590,13.5636);
SetSpawnInfo(playerid, PlayerInfo[playerid][pFaction], PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pPos_X], PlayerInfo[playerid][pPos_Y], PlayerInfo[playerid][pPos_Z], 1.0, -1, -1, -1, -1, -1, -1);
SpawnPlayer(playerid);
return 1;
}
So that way if they had a skin saved they have to choose it and after they click spawn it spawns them in the last place they were at, and if they are new they get to choose a skin. I think that is how that works, im kinda new to scripting so im not sure :P. But I coded that by myself the onplayerrequest thing and it works fine and I just used your code on the onplayerrequestspawn ^-^, goodluck!
Reply
#11

Well just make sure that when you SetPlayerCameraPos, SetPlayerCameraLookAt, SetSpawnInfo, just to SetPlayerInterior at that point?

You could save that also.

Actually... it's late, I think I'm wrong.
Reply
#12

I just got Confused im sure he did too.. hehe
Reply
#13

Yea you guys lost me xD. My skin is all good, i just dont want to see myself falling before i get spawned o.o
Reply
#14

I sent you a pm man go read it..
Reply
#15

If you're trying to say that sometimes when you spawn you fall through the interior floor then you should SetPlayerPos in OnPlayerSpawn.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)