[BUG] AttachCameraToPlayerObject
#1

Performing an AttachCameraToPlayerObject will crash the player with a "Loading..." screen in GTA:SA.

pawn Код:
TogglePlayerSpectating(playerid, true);
AttachCameraToPlayerObject(playerid, CreatePlayerObject(playerid, 19300, 0.0, 0.0, 2.0, 0, 0, 0));
EDIT:

It's related to uptime, if a SA:MP server's uptime is ~2 weeks or more, this causes the client to crash.
Reply
#2

What happens if u remove the spectate function?
Reply
#3

Usually when you get that screen the position is at some extreme coordinates what I think is happening is the way your trying to do this instead create the object when they login to the server....

CameraObjects[MAX_PLAYERS];
CameraObject = CreatePlayerObject(playerid, 19300, 0.0, 0.0, 2.0, 0, 0, 0);

Eventually with the code you have would fill up a players object slots anyways.
Reply
#4

Quote:
Originally Posted by Strawhats
Посмотреть сообщение
What happens if u remove the spectate function?
Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Usually when you get that screen the position is at some extreme coordinates what I think is happening is the way your trying to do this instead create the object when they login to the server....

CameraObjects[MAX_PLAYERS];
CameraObject = CreatePlayerObject(playerid, 19300, 0.0, 0.0, 2.0, 0, 0, 0);

Eventually with the code you have would fill up a players object slots anyways.
The issue remains with the spectate function removed.
Reply
#5

why did u post the spectate function then? lol

did u try with normal non player objects
Reply
#6

Quote:
Originally Posted by mastermax7777
Посмотреть сообщение
why did u post the spectate function then? lol

did u try with normal non player objects
This needs to work with AttachCameraToPlayerObject, I could care less about Global objects.
Reply
#7

Try to store object id into a variable and use variable in attaching camera to object.
I know that i was attaching camera to a moving object and it worked fine...
Reply
#8

Quote:

The player-object must be created before attempting to attach the player's camera to it.

You attach the camera before the object is created.
Reply
#9

if you do it with an player object that is attached to the player itself (as i did for my firstperson cam) it will fuck up the coordinates of the camera somehow.
If your using it for cars or attached vehicle objects its working fine.

This solution as you see here works: //even though partly
Код:
new pObject[MAX_PLAYERS];

forward attachcamtohead(playerid);
public attachcamtohead(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid,X,Y,Z);
pObject[playerid] = CreatePlayerObject(playerid, 19300, X, Y, Z+0.65, 0.0, 0, 0.0);
SetPlayerAttachedObject(playerid, 3, pObject[playerid], 2, 0.101, -0.0, 0.0, 5.50, 84.60, 83.7, 1, 1, 1);
AttachCameraToPlayerObject(playerid,pObject[playerid]);
return 1;
}
but what is the spectate thingy good for ?
Reply
#10

I've found out the issue, on a Linux (CentOS) server, it is related to the SAMP server uptime.

We've killed the samp process and turned it back on and it works without any issue, so it seems related to uptime.
Reply
#11

Same problem, and yes, it's related to uptime...
Reply
#12

Exactly, it seems to be after 2 weeks or so, can we please get a response?
Reply
#13

Did you try to maybe set the world bounds, bigger than the map? That Loading screen usually comes up if the player is out of the world.
Reply
#14

To my knowledge, CreatePlayerObject (and CreateObject too) cannot be called inside AttachCameraToPlayerObject.

This should work just fine:
Код:
new obj = CreatePlayerObject(...);
AttachCameraToPlayerObject(playerid, obj);
Why? I don't know. It works like that for some reason.
Reply
#15

I get bugs because of uptime as well, but with timers instead.
Reply
#16

This Loading ... also comes if you set the Gravity to a very high value.

EDIT: View the Flymode by h02. You can obtain the fix.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)