Esempio n. 1
0
    void OnUseWithTool(int player, int x, int y, int z, int tool)
    {
        if (server.modManager.GetBlockName(tool) == "Sign")
        {
            ServerChunk c = server.d_Map.GetChunk(x, y, z);
            if (c == null)
            {
                return;
            }

            if (!server.CheckBuildPrivileges(player, x, y, z))
            {
                return;
            }

            ServerEntity e = new ServerEntity();
            e.position         = new ServerEntityPositionAndOrientation();
            e.position.x       = x + one / 2;
            e.position.y       = z;
            e.position.z       = y + one / 2;
            e.position.heading = EntityHeading.GetHeading(server.modManager.GetPlayerPositionX(player), server.modManager.GetPlayerPositionY(player), e.position.x, e.position.z);
            e.sign             = new ServerEntitySign();
            e.sign.text        = "Hello world!";
            server.AddEntity(x, y, z, e);
        }
    }
Esempio n. 2
0
    void OnUseWithTool(int player, int x, int y, int z, int tool)
    {
        if (server.modManager.GetBlockName(tool) == "PermissionSign")
        {
            ServerChunk c = server.d_Map.GetChunk(x, y, z);
            if (c == null)
            {
                return;
            }

            if (!server.CheckBuildPrivileges(player, x, y, z))
            {
                return;
            }

            if (!server.PlayerHasPrivilege(player, ServerClientMisc.Privilege.area_add))
            {
                server.SendMessage(player, server.colorError + server.language.Get("Server_CommandInsufficientPrivileges"));
                return;
            }

            ServerEntity e = new ServerEntity();
            e.position         = new ServerEntityPositionAndOrientation();
            e.position.x       = x + one / 2;
            e.position.y       = z;
            e.position.z       = y + one / 2;
            e.position.heading = EntityHeading.GetHeading(server.modManager.GetPlayerPositionX(player), server.modManager.GetPlayerPositionY(player), e.position.x, e.position.z);

            e.permissionSign      = new ServerEntityPermissionSign();
            e.permissionSign.name = "Admin";
            e.permissionSign.type = PermissionSignType.Group;
            server.AddEntity(x, y, z, e);
        }
    }