When My Character Dies!
#1

When my character dies.. My position gets set to where the playerclass is added onto the OnGameModeInit();

Код:
AddPlayerClass(265,-1590.5083,716.0220,-5.2422,269.2736,0,0,0,0,0,0); //
Location = -1590.5083,716.0220,-5.2422,269.2736
Reply
#2

The default spawn position is the one you set in SetPlayerClass, if you want that altered you need to move them using SetPlayerPos under OnPlayerSpawn(playerid)
Reply
#3

Set the player position on callback OnPlayerSpawn.

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 0.0, 0.0, 0.0);//your pos here
    return 1;
}
Reply
#4

Quote:
Originally Posted by Redgie
Посмотреть сообщение
The default spawn position is the one you set in OnPlayerClass, if you want that altered you need to move them using SetPlayerPos under OnPlayerSpawn(playerid)
I'm using a float: for onplayerspawn...


OnPlayerSpawn
Код:
	   
new rnd = random(sizeof(SpawnPoints));
SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]);
SetPlayerFacingAngle(playerid, SpawnPoints[rnd][3]);
SetCameraBehindPlayer(playerid);
Reply
#5

Could you show the array for "SpawnPoints" please.
Reply
#6

Код:
new Float:SpawnPoints[18][4] =
{
{-1498.3470,931.3514,7.1875},
{-1639.5243,1201.9764,7.2270},
{-1724.2661,908.4559,24.8906},
{-1969.2166,308.5361,35.1719},
{-1984.5724,185.8245,27.6799},
{-2033.0598,180.5838,28.8429},
{-2093.3123,-78.1040,35.3203},
{-2414.8323,753.4859,35.1719},
{-2761.7749,377.3954,5.3670},
{-2676.8608,264.6314,4.6328},
{-1496.3367,904.7078,7.1875},
{-1749.9264,960.2077,24.8828},
{-1980.9019,1120.1901,53.1256},
{-2243.8044,943.8950,66.6484},
{-2243.4663,753.3155,49.4393},
{-2442.1355,746.6382,35.0156},
{-2760.9460,375.2620,5.0312},
{-2345.2627,-139.9374,35.5547}
};
Reply
#7

pawn Код:
new Float:SpawnPoints[18][3] =
{
{-1498.3470,931.3514,7.1875},
{-1639.5243,1201.9764,7.2270},
{-1724.2661,908.4559,24.8906},
{-1969.2166,308.5361,35.1719},
{-1984.5724,185.8245,27.6799},
{-2033.0598,180.5838,28.8429},
{-2093.3123,-78.1040,35.3203},
{-2414.8323,753.4859,35.1719},
{-2761.7749,377.3954,5.3670},
{-2676.8608,264.6314,4.6328},
{-1496.3367,904.7078,7.1875},
{-1749.9264,960.2077,24.8828},
{-1980.9019,1120.1901,53.1256},
{-2243.8044,943.8950,66.6484},
{-2243.4663,753.3155,49.4393},
{-2442.1355,746.6382,35.0156},
{-2760.9460,375.2620,5.0312},
{-2345.2627,-139.9374,35.5547}
};
Untested.
Reply
#8

It must be [4] since

Код:
	   
new rnd = random(sizeof(SpawnPoints));
SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]);
SetPlayerFacingAngle(playerid, SpawnPoints[rnd][3]);
SetCameraBehindPlayer(playerid);
Error if it's [3]
Код:
 error 032: array index out of bounds (variable "SpawnPoints")
Reply
#9

By the looks of it though, you only have 3 variables.

pawn Код:
{-1498.3470,     931.3514,    7.1875},
Try removing both the [18][4] and just have [][].
Reply
#10

Код:
new Float:SpawnPoints[18][3] =
{
{-1498.3470,931.3514,7.1875},
{-1639.5243,1201.9764,7.2270},
{-1724.2661,908.4559,24.8906},
{-1969.2166,308.5361,35.1719},
{-1984.5724,185.8245,27.6799},
{-2033.0598,180.5838,28.8429},
{-2093.3123,-78.1040,35.3203},
{-2414.8323,753.4859,35.1719},
{-2761.7749,377.3954,5.3670},
{-2676.8608,264.6314,4.6328},
{-1496.3367,904.7078,7.1875},
{-1749.9264,960.2077,24.8828},
{-1980.9019,1120.1901,53.1256},
{-2243.8044,943.8950,66.6484},
{-2243.4663,753.3155,49.4393},
{-2442.1355,746.6382,35.0156},
{-2760.9460,375.2620,5.0312},
{-2345.2627,-139.9374,35.5547}
};
Now This Is Chaged:
Код:
SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]);
0, 1 & 2 = 3

Still got the problem D:

I Did what you asked and it didn't work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)