what exactly is the difference between OnPlayerReSpawned or OnPlayerSpawn?
I thought it was something along the lines of --
OnPlayerSpawn -- utilized when your character is created for the first time, and/or when you login+spawn into the server.
as compared to
OnPlayerReSpawn -- utilized when any player character teleports or dies or has something else happen that causes it to spawn again.
I'm trying to utilize either/or and not getting anywhere. I'm trying to obtain the person's location / position at the moment that they die.
Here's my test code. It does not appear to ever get called. When I teleported a few times and died, the console showed the teleports and provides the reason "teleport", also the reason "died", but these hook-methods are never called as far as I can tell.
I assume you are you using a return object of "object" rather than "bool" because it differs between games?
Can you please implement the OnPlayerDeath hook? =) It would be nice to have.
Other ideas of how to accomplish what I'm trying to do --
I was thinking of using "OnEntityDeath" and somehow checking whether the entity was a player, but I can't figure out how to accomplish that. Or barring that, create a recurring method that records all online player locations in an array / collection every second, recording 2 seconds worth and also check if they have died (not sure how to reach an appropriate object such as PlayerManager.allPlayers). Hence, if they died this second, last second should have recorded a reasonably close location (assuming their position at death may or may not be accurate or reset to their bed location already). Also I figure every second rather than faster than that (less of a strain on resources).
Thanks!
Rog
I thought it was something along the lines of --
OnPlayerSpawn -- utilized when your character is created for the first time, and/or when you login+spawn into the server.
as compared to
OnPlayerReSpawn -- utilized when any player character teleports or dies or has something else happen that causes it to spawn again.
I'm trying to utilize either/or and not getting anywhere. I'm trying to obtain the person's location / position at the moment that they die.
Here's my test code. It does not appear to ever get called. When I teleported a few times and died, the console showed the teleports and provides the reason "teleport", also the reason "died", but these hook-methods are never called as far as I can tell.
void OnPlayerReSpawned(ClientInfo ci, string reason)
{
float x, y, z;
ci.IPlayer.Position( out x, out y, out z );
NextFrame( () => ci.IPlayer.Message( "Player Spawn... xyz {0},{1},{2} reason - {3}", "", x,y,z,reason ) );
}
object OnPlayerSpawn(ClientInfo ci)
{
if ( ci != null )
{
float x, y, z;
ci.IPlayer.Position( out x, out y, out z );
NextFrame( () => ci.IPlayer.Message( "Player Spawn... xyz {0},{1},{2} no reason.. you just spawned.. =D", "", x, y, z ) );
}
return false;
}
I assume you are you using a return object of "object" rather than "bool" because it differs between games?
Can you please implement the OnPlayerDeath hook? =) It would be nice to have.
Other ideas of how to accomplish what I'm trying to do --
I was thinking of using "OnEntityDeath" and somehow checking whether the entity was a player, but I can't figure out how to accomplish that. Or barring that, create a recurring method that records all online player locations in an array / collection every second, recording 2 seconds worth and also check if they have died (not sure how to reach an appropriate object such as PlayerManager.allPlayers). Hence, if they died this second, last second should have recorded a reasonably close location (assuming their position at death may or may not be accurate or reset to their bed location already). Also I figure every second rather than faster than that (less of a strain on resources).
Thanks!
Rog