Example #1
0
        public byte[] PlayerData(int index)
        {
            KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();

            // prevent out of bounds
            if (index > Constants.MAX_PLAYERS)
                return null;

            buffer.WriteInteger((int)Enumerations.ServerPackets.SPlayerData);
            buffer.WriteInteger(index);
            buffer.WriteFloat(Globals.general.GetPlayerX(index));
            buffer.WriteFloat(Globals.general.GetPlayerY(index));
            buffer.WriteFloat(Globals.general.GetPlayerZ(index));

            buffer.WriteString(Globals.player[index].Username);
            return buffer.ToArray();
        }
    public void SendMovement(float x, float y, float z, float rotX, float rotY, float rotZ, float rotW)
    {
        KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
        buffer.WriteInteger((int)Enumerations.ClientPackets.CHandleMovement);

        // Send position and rotation

        buffer.WriteFloat(x);
        buffer.WriteFloat(y);
        buffer.WriteFloat(z);

        buffer.WriteFloat(rotX);
        buffer.WriteFloat(rotY);
        buffer.WriteFloat(rotZ);
        buffer.WriteFloat(rotW);

        SendDataToServer(buffer.ToArray());
        buffer = null;
    }
Example #3
0
        public void SendPlayerMovement(int index, float x, float y, float z, float rotX, float rotY, float rotZ, float rotW)
        {
            KaymakGames.KaymakGames buffer = new KaymakGames.KaymakGames();
            buffer.WriteInteger((int)Enumerations.ServerPackets.SPlayersMovement);

            //Player Info

            buffer.WriteInteger(index);

            // Player Position

            buffer.WriteFloat(x);
            buffer.WriteFloat(y);
            buffer.WriteFloat(z);

            buffer.WriteFloat(rotX);
            buffer.WriteFloat(rotY);
            buffer.WriteFloat(rotZ);
            buffer.WriteFloat(rotW);

            SendDataToAllBut(index, buffer.ToArray());
        }