SA-MP Forums Archive
SetPlayerPos won't work under OnPlayerRequestClass - 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: SetPlayerPos won't work under OnPlayerRequestClass (/showthread.php?tid=150921)



SetPlayerPos won't work under OnPlayerRequestClass - Joe_ - 28.05.2010

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




Re: SetPlayerPos won't work under OnPlayerRequestClass - Flashy - 28.05.2010

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


Re: SetPlayerPos won't work under OnPlayerRequestClass - Joe_ - 28.05.2010

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


Re: SetPlayerPos won't work under OnPlayerRequestClass - playbox12 - 28.05.2010

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


Re: SetPlayerPos won't work under OnPlayerRequestClass - DJDhan - 28.05.2010

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.


Re: SetPlayerPos won't work under OnPlayerRequestClass - [XST]O_x - 28.05.2010

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


Re: SetPlayerPos won't work under OnPlayerRequestClass - Joe_ - 28.05.2010

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)