[DiscordArchive] So Shauren a buddy of mine was storing player in his script and i told him he should store playerGUI
[DiscordArchive] So Shauren a buddy of mine was storing player in his script and i told him he should store playerGUI
Archived author: Malcrom • Posted: 2024-01-16T15:17:11.613000+00:00
Original source
So Shauren a buddy of mine was storing player in his script and i told him he should store playerGUID. Can you tell me the proper reason so I can pass it on?
Archived author: Northstrider • Posted: 2024-01-16T15:18:37.488000+00:00
Original source
player can go offline and the pointer can become invalid
Archived author: Northstrider • Posted: 2024-01-16T15:18:44.191000+00:00
Original source
there
Archived author: ModoX • Posted: 2024-01-16T15:18:46.645000+00:00
Original source
Imagine player disconnects. The pointer is still pointing to the initial player memory, aka is now pointing to freed memory
Archived author: Malcrom • Posted: 2024-01-16T15:18:49.538000+00:00
Original source
cool
Archived author: Malcrom • Posted: 2024-01-16T15:19:00.128000+00:00
Original source
ty
Archived author: Northstrider • Posted: 2024-01-16T15:19:24.659000+00:00
Original source
same goes for any object. it can disappear at any given time so storing a direct pointer to it is suicide
Archived author: Malcrom • Posted: 2024-01-16T15:21:34.805000+00:00
Original source
And a player check would not work?
Archived author: ModoX • Posted: 2024-01-16T15:22:18.600000+00:00
Original source
if (player) only checks if player == nullptr
Archived author: Northstrider • Posted: 2024-01-16T15:22:19.273000+00:00
Original source
no, because a pointer just points to an address in memory so if that memory gets freed or used by sth else, it blows up