Spawning -
Anthonyx3' - 26.11.2010
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.
Re: Spawning -
XoSarahMoX - 26.11.2010
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.
Re: Spawning -
Buzzbomb - 26.11.2010
Are you talking about saving player position?
Re: Spawning -
iggy1 - 26.11.2010
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).
Re: Spawning -
Anthonyx3' - 26.11.2010
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
Re: Spawning -
Buzzbomb - 26.11.2010
Did it work the way you wanted it too?
Re: Spawning -
Anthonyx3' - 26.11.2010
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
Re: Spawning -
Buzzbomb - 26.11.2010
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...
Re: Spawning -
Anthonyx3' - 26.11.2010
i set it there because i want to bypass << >> spawn
Re: Spawning -
XoSarahMoX - 26.11.2010
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!
Re: Spawning -
Austin - 26.11.2010
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.
Re: Spawning -
Buzzbomb - 26.11.2010
I just got Confused im sure he did too.. hehe
Re: Spawning -
Anthonyx3' - 26.11.2010
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
Re: Spawning -
Buzzbomb - 26.11.2010
I sent you a pm man go read it..
Re: Spawning -
Austin - 26.11.2010
If you're trying to say that sometimes when you spawn you fall through the interior floor then you should SetPlayerPos in OnPlayerSpawn.