Exemple #1
0
            private static int OnHandleMapPinSetMapPinAtMessage(void *pMessage, void *pPlayer)
            {
                CNWSMessage message = CNWSMessage.FromPointer(pMessage);
                CNWSPlayer  player  = CNWSPlayer.FromPointer(pPlayer);

                if (player == null)
                {
                    return(Hook.CallOriginal(pMessage, pPlayer));
                }

                // Coordinates
                int   offset = 0;
                float x      = message.PeekMessage <float>(offset);

                offset += sizeof(float);
                float y = message.PeekMessage <float>(offset);

                offset += sizeof(float);
                float z = message.PeekMessage <float>(offset);

                offset += sizeof(float);

                // Note
                string note = message.PeekMessageString(offset);

                OnMapPinAddPin eventData = ProcessEvent(new OnMapPinAddPin
                {
                    Player   = player.ToNwPlayer() !,
                    Position = new Vector3(x, y, z),
                    Note     = note,
                });
            private static int OnHandleMapPinDestroyMapPinMessage(void *pMessage, void *pPlayer)
            {
                CNWSMessage message = CNWSMessage.FromPointer(pMessage);
                CNWSPlayer  player  = CNWSPlayer.FromPointer(pPlayer);

                if (player == null)
                {
                    return(Hook.CallOriginal(pMessage, pPlayer));
                }

                // Id
                int id = message.PeekMessage <int>(0);

                OnMapPinDestroyPin eventData = ProcessEvent(new OnMapPinDestroyPin
                {
                    Player = player.ToNwPlayer() !,
                    Id     = id,
                });