SampSharp
SampSharp copied to clipboard
[GM] Fixed wrong BasePlayer returned on NPC connection
Actually the ConnectNPC method returns a empty BasePlayer instance. The problem is we can't know when the NPC will be connected to the server ..
So I've created a "NPC" class with a Thread in it to loop through all connected players and check if a player matches with the NPC. When a player matches with the NPC (same name, and "IsNPC" is true), an event is triggered to be able to make some actions after the NPC connection.