SetPlayerPos won't work under OnPlayerRequestClass
#1

Yeah the title says it all.

I use this for test.

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
new Float:x, Float:y, Float:z;
SetPlayerPos(playerid, 5.0, 5.0, 5.0);
GetPlayerPos(playerid, x, y, z); printf("%f %f %f", x, y, z);
return 1;
}
From server log

[16:50:23] 0.000000 0.000000 0.000000
[16:50:24] 0.000000 0.000000 0.000000
[16:50:30] 0.000000 0.000000 0.000000
[16:50:30] 0.000000 0.000000 0.000000

Why aint it setting my pos to 5.0?...

Reply
#2

You canґt put SetPlayerPos and GetPlayerPos in same time xDD
Reply
#3

Well I can't see myself either, My camera is 10.0 (X and Y) away from the SetPos, and is looking at the SetPos, I'm not there
Reply
#4

Quote:
Originally Posted by Flashy
You canґt put SetPlayerPos and GetPlayerPos in same time xDD
Offcourse you can, stop talking bullshit.
Reply
#5

Maybe you forgot to add player classes? That maybe a reason you can't see yourself. Otherwise it should work. Check your AddPlayerClass function if you have them.
Reply
#6

Do you have SetPlayerCameraLookAt(playerid,5.0,5.0,5.0); ? If you do it should work.
Reply
#7

I use an array to store the sets of coordinates per class.

pawn Код:
enum E_CLASS_DATA
{
    SkinID,
    Float:PlayerPosX,
    Float:PlayerPosY,
    Float:PlayerPosZ,
    Float:PlayerPosA,
    Float:SpawnX,
    Float:SpawnY,
    Float:SpawnZ,
    Float:SpawnA,
    Float:CamPosX,
    Float:CamPosY,
    Float:CamPosZ,
    Text[128],
}

new cData[][E_CLASS_DATA] =
{
    {105, 2457.687500, -1677.946533, 13.504999, 67.715721, 2495.215332, -1686.504882, 13.513961, 4.950347, 2454.773437, -1676.751342, 13.502408, "~n~~n~~g~Grove Street"},
    {106, 2457.687500, -1677.946533, 13.504999, 67.715721, 2495.215332, -1686.504882, 13.513961, 4.950347, 2454.773437, -1676.751342, 13.502408, "~n~~n~~g~Grove Street"},
    {107, 2457.687500, -1677.946533, 13.504999, 67.715721, 2495.215332, -1686.504882, 13.513961, 4.950347, 2454.773437, -1676.751342, 13.502408, "~n~~n~~g~Grove Street"}
};
pawn Код:
public OnGameModeInit()
{
for(new g; g < sizeof(cData); g++)
    {
      AddPlayerClass(cData[g][SkinID], cData[g][SpawnX], cData[g][SpawnY], cData[g][SpawnZ], cData[g][SpawnA], 0, 0, 0, 0, 0, 0);
      return 1;
    }
return 1;
}
pawn Код:
stock ClassSelection(playerid)
{
  for(new g; g < sizeof(cData[]); g++)
    {
      SetPlayerPos(playerid, cData[g][PlayerPosX], cData[g][PlayerPosY], cData[g][PlayerPosX]);
        SetPlayerFacingAngle(playerid, cData[g][PlayerPosA]);
      SetPlayerCameraPos(playerid, cData[g][CamPosX], cData[g][CamPosY], cData[g][CamPosZ]);
      SetPlayerCameraLookAt(playerid, cData[g][PlayerPosX], cData[g][PlayerPosY], cData[g][PlayerPosZ]);
      GameTextForPlayer(playerid, cData[g][Text], 3000, 4);
    }
}

public OnPlayerRequestClass(playerid, classid)
{
    ClassSelection(playerid);
 
}
That's what I'm using (for a more dynamic type of way)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)